Modified handling of state-dependent timeouts. Matches existing tests and documentation.
authorZdeněk Šustr <sustr4@cesnet.cz>
Thu, 19 Mar 2009 16:41:38 +0000 (16:41 +0000)
committerZdeněk Šustr <sustr4@cesnet.cz>
Thu, 19 Mar 2009 16:41:38 +0000 (16:41 +0000)
org.glite.lb.server/src/srv_purge.c

index ddc2847..49c47dd 100644 (file)
@@ -292,11 +292,14 @@ int edg_wll_PurgeServer(edg_wll_Context ctx,const edg_wll_PurgeRequest *request,
                                start = time(NULL);
 
                for (i=0; i<EDG_WLL_NUMBER_OF_STATCODES; i++)
-                       timeout[i] = request->timeout[i] < 0 ? 
-                               ( request->timeout[EDG_WLL_PURGE_JOBSTAT_OTHER] < 0 ?
-                                       ctx->purge_timeout[i] : 
-                                       request->timeout[EDG_WLL_PURGE_JOBSTAT_OTHER] ) :
-                               request->timeout[i];
+                       if (request->timeout[i] < 0) { // no specific timeout
+                               if (request->timeout[i] == -2) //no purge
+                                       timeout[i] = request->timeout[i];
+                               else {// use server default
+                                       timeout[i] = ctx->purge_timeout[i];
+                               }
+                       }
+                       else timeout[i] = request->timeout[i]; //specific given
 
                if ((jobs_to_exa = edg_wll_ExecSQL(ctx, (ctx->isProxy) ? "select dg_jobid from jobs where proxy='1'" :
                        "select dg_jobid from jobs where server='1'", &s)) < 0) goto abort;
@@ -329,7 +332,7 @@ int edg_wll_PurgeServer(edg_wll_Context ctx,const edg_wll_PurgeRequest *request,
                                        goto abort; 
                                }
 
-                               if (stat.lastUpdateTime.tv_sec && start-stat.lastUpdateTime.tv_sec > timeout[stat.state] && !check_strict_jobid(ctx,job))
+                               if (timeout[stat.state] >=0 && stat.lastUpdateTime.tv_sec && start-stat.lastUpdateTime.tv_sec > timeout[stat.state] && !check_strict_jobid(ctx,job))
                                {
                                        if (purge_one(ctx,job,dumpfile,request->flags&EDG_WLL_PURGE_REALLY_PURGE,ctx->isProxy)) {
                                                edg_wll_FreeStatus(&stat);