MCPcopy Create free account
hub / github.com/facebook/CacheLib / runJob

Method runJob

cachelib/navy/scheduler/ThreadPoolJobQueue.cpp:112–147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110}
111
112JobExitCode JobQueue::runJob(QueueEntry& entry) {
113 auto safeJob = [&entry] {
114 try {
115 return entry.job();
116 } catch (const std::exception& ex) {
117 XLOGF(ERR, "Exception thrown from the job: {}", ex.what());
118 util::printExceptionStackTraces();
119 throw;
120 } catch (...) {
121 XLOG(ERR, "Unknown exception thrown from the job");
122 util::printExceptionStackTraces();
123 throw;
124 }
125 };
126
127 auto exitCode = safeJob();
128 switch (exitCode) {
129 case JobExitCode::Reschedule: {
130 entry.rescheduleCount++;
131 if (entry.rescheduleCount >= kHighRescheduleCount &&
132 entry.rescheduleCount % kHighRescheduleReportRate == 0) {
133 XLOGF(DBG,
134 "Job '{}' rescheduled {} times",
135 entry.name,
136 entry.rescheduleCount);
137 }
138 break;
139 }
140 case JobExitCode::Done: {
141 // Deallocate outside the lock:
142 entry.job = Job{};
143 break;
144 }
145 }
146 return exitCode;
147}
148
149uint64_t JobQueue::finish() {
150 // Busy wait, but used only in tests

Callers

nothing calls this directly

Calls 2

whatMethod · 0.80

Tested by

no test coverage detected