r4195 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Tue Aug 18 13:16:06 CEST 2009


Author: phk
Date: 2009-08-18 13:16:05 +0200 (Tue, 18 Aug 2009)
New Revision: 4195

Modified:
   trunk/varnish-cache/bin/varnishd/cache_expire.c
   trunk/varnish-cache/bin/varnishd/cache_vcl.c
Log:
Avoid the 10 second sleep while waiting for the VCL to appear.



Modified: trunk/varnish-cache/bin/varnishd/cache_expire.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_expire.c	2009-08-18 11:14:35 UTC (rev 4194)
+++ trunk/varnish-cache/bin/varnishd/cache_expire.c	2009-08-18 11:16:05 UTC (rev 4195)
@@ -246,7 +246,6 @@
 	struct objcore_head *lru;
 
 	(void)priv;
-	AZ(sleep(10));		/* XXX: Takes time for VCL to arrive */
 	VCL_Get(&sp->vcl);
 	t = TIM_real();
 	while (1) {

Modified: trunk/varnish-cache/bin/varnishd/cache_vcl.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_vcl.c	2009-08-18 11:14:35 UTC (rev 4194)
+++ trunk/varnish-cache/bin/varnishd/cache_vcl.c	2009-08-18 11:16:05 UTC (rev 4195)
@@ -84,7 +84,13 @@
 void
 VCL_Get(struct VCL_conf **vcc)
 {
+	static int once;
 
+	while (!once && vcl_active == NULL) {
+		sleep(1);
+	}
+	once = 1;
+
 	Lck_Lock(&vcl_mtx);
 	AN(vcl_active);
 	*vcc = vcl_active->conf;



More information about the varnish-commit mailing list