From: Aleš Křenek Date: Thu, 22 May 2008 11:03:51 +0000 (+0000) Subject: change semantics of timeouts in purge request X-Git-Tag: glite-yaim-lb_R_4_0_2_1~28 X-Git-Url: http://scientific.zcu.cz/git/?a=commitdiff_plain;h=5d414feac451b89c493d3c0a0042ef93331f4e28;p=jra1mw.git change semantics of timeouts in purge request - 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 --- diff --git a/org.glite.lb.server/src/bkserverd.c b/org.glite.lb.server/src/bkserverd.c index b861495..b85470c 100644 --- a/org.glite.lb.server/src/bkserverd.c +++ b/org.glite.lb.server/src/bkserverd.c @@ -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; diff --git a/org.glite.lb.server/src/srv_purge.c b/org.glite.lb.server/src/srv_purge.c index 566f639..b044bf5 100644 --- a/org.glite.lb.server/src/srv_purge.c +++ b/org.glite.lb.server/src/srv_purge.c @@ -290,7 +290,11 @@ int edg_wll_PurgeServer(edg_wll_Context ctx,const edg_wll_PurgeRequest *request, now = time(NULL); for (i=0; itimeout[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);