change semantics of timeouts in purge request
authorAleš Křenek <ljocha@ics.muni.cz>
Thu, 22 May 2008 11:03:51 +0000 (11:03 +0000)
committerAleš Křenek <ljocha@ics.muni.cz>
Thu, 22 May 2008 11:03:51 +0000 (11:03 +0000)
- if specified explicitely for _any_ state, the timeout is favoured
- otherwise OTHER in the request is used if specified
- server-side defaults are taken only if none of the previous cases holds

org.glite.lb.server/src/bkserverd.c
org.glite.lb.server/src/srv_purge.c

index b861495..b85470c 100644 (file)
@@ -398,7 +398,7 @@ int main(int argc, char *argv[])
        server_cert = server_key = cadir = vomsdir = NULL;
 
 /* no magic here: 1 month, 3 and 7 days */
-       purge_timeout[EDG_WLL_PURGE_JOBSTAT_OTHER] = 60*60*24*31;       
+       for (i=0; i < EDG_WLL_NUMBER_OF_STATCODES; i++) purge_timeout[i] = 60*60*24*31; 
        purge_timeout[EDG_WLL_JOB_CLEARED] = 60*60*24*3;
        purge_timeout[EDG_WLL_JOB_ABORTED] = 60*60*24*7;
        purge_timeout[EDG_WLL_JOB_CANCELLED] = 60*60*24*7;
index 566f639..b044bf5 100644 (file)
@@ -290,7 +290,11 @@ int edg_wll_PurgeServer(edg_wll_Context ctx,const edg_wll_PurgeRequest *request,
                                now = time(NULL);
 
                for (i=0; i<EDG_WLL_NUMBER_OF_STATCODES; i++)
-                       timeout[i] = request->timeout[i] < 0 ? ctx->purge_timeout[i] : request->timeout[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 (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;
@@ -321,17 +325,7 @@ int edg_wll_PurgeServer(edg_wll_Context ctx,const edg_wll_PurgeRequest *request,
                                        goto abort; 
                                }
 
-                               switch (stat.state) {
-                                       case EDG_WLL_JOB_CLEARED:
-                                       case EDG_WLL_JOB_ABORTED:
-                                       case EDG_WLL_JOB_CANCELLED:
-                                               i = stat.state;
-                                               break;
-                                       default:
-                                               i = EDG_WLL_PURGE_JOBSTAT_OTHER;
-                               }
-
-                               if (now-stat.lastUpdateTime.tv_sec > timeout[i] && !check_strict_jobid(ctx,job))
+                               if (now-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);