r232 - trunk/varnish-cache/bin/varnishd
phk at projects.linpro.no
phk at projects.linpro.no
Sun Jun 25 00:11:55 CEST 2006
Author: phk
Date: 2006-06-25 00:11:55 +0200 (Sun, 25 Jun 2006)
New Revision: 232
Modified:
trunk/varnish-cache/bin/varnishd/cache_expire.c
Log:
A little bit more work on the expiry/prefetch thing.
Modified: trunk/varnish-cache/bin/varnishd/cache_expire.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_expire.c 2006-06-24 21:54:54 UTC (rev 231)
+++ trunk/varnish-cache/bin/varnishd/cache_expire.c 2006-06-24 22:11:55 UTC (rev 232)
@@ -16,6 +16,7 @@
static pthread_t exp_thread;
static struct binheap *exp_heap;
static pthread_mutex_t expmtx;
+static unsigned expearly = 30;
/*--------------------------------------------------------------------*/
@@ -40,12 +41,17 @@
time(&t);
AZ(pthread_mutex_lock(&expmtx));
o = binheap_root(exp_heap);
+ if (o == NULL || o->ttl - t > expearly) {
+ AZ(pthread_mutex_unlock(&expmtx));
+ if (o != NULL)
+ printf("Root: %p %d (%d)\n",
+ (void*)o, o->ttl, o->ttl - t);
+ sleep(1);
+ continue;
+ }
+ printf("Root: %p %d (%d)\n", (void*)o, o->ttl, o->ttl - t);
+ binheap_delete(exp_heap, 0);
AZ(pthread_mutex_unlock(&expmtx));
- if (o != NULL) {
- printf("Root: %p %d (%d)\n",
- (void*)o, o->ttl, o->ttl - t);
- }
- sleep(1);
}
return ("FOOBAR");
More information about the varnish-commit
mailing list