MCPcopy Create free account
hub / github.com/ClassiCube/ClassiCube / Http_CleanCacheTask

Function Http_CleanCacheTask

src/_HttpBase.h:310–328  ·  view source on GitHub ↗

Deletes cached responses that are over 10 seconds old */

Source from the content-addressed store, hash-verified

308
309/* Deletes cached responses that are over 10 seconds old */
310static void Http_CleanCacheTask(struct ScheduledTask* task) {
311 struct HttpRequest* item;
312 int i;
313
314 Mutex_Lock(processedMutex);
315 {
316 cc_uint64 now = Stopwatch_Measure();
317 for (i = processedReqs.count - 1; i >= 0; i--)
318 {
319 item = &processedReqs.entries[i];
320 if (Stopwatch_ElapsedMS(item->timeDownloaded, now) < 10 * 1000) continue;
321
322 Platform_Log1("Cleaning up forgotten download for %c", item->url);
323 HttpRequest_Free(item);
324 RequestList_RemoveAt(&processedReqs, i);
325 }
326 }
327 Mutex_Unlock(processedMutex);
328}
329
330
331/*########################################################################################################################*

Callers

nothing calls this directly

Calls 7

Stopwatch_ElapsedMSFunction · 0.85
Platform_Log1Function · 0.85
RequestList_RemoveAtFunction · 0.85
Mutex_LockFunction · 0.70
Stopwatch_MeasureFunction · 0.70
HttpRequest_FreeFunction · 0.70
Mutex_UnlockFunction · 0.70

Tested by

no test coverage detected