From: Jiří Filipovič Date: Wed, 1 Aug 2007 18:59:24 +0000 (+0000) Subject: - fixed upload deadline storage format X-Git-Tag: glite-jp-primary_R_1_4_0_1~10 X-Git-Url: http://scientific.zcu.cz/git/?a=commitdiff_plain;h=eb9722fe4156fae6605cddffe291d129abf5b3df;p=jra1mw.git - fixed upload deadline storage format - removing records of expired file upload - shorted implicit and maximal time to upload file --- diff --git a/org.glite.jp.primary/src/new_ftp_backend.c b/org.glite.jp.primary/src/new_ftp_backend.c index 8dd5421..b3899f2 100644 --- a/org.glite.jp.primary/src/new_ftp_backend.c +++ b/org.glite.jp.primary/src/new_ftp_backend.c @@ -485,7 +485,7 @@ int glite_jppsbe_start_upload( /* XXX: gsoap does not like so much, one year should be enough *commit_before_inout = (time_t) LONG_MAX; */ - *commit_before_inout = time(NULL) + 365*24*60*60; + *commit_before_inout = time(NULL) + 5*60;//365*24*60*60; /* if (add_to_gridmap(ctx, peername)) { @@ -494,6 +494,8 @@ int glite_jppsbe_start_upload( goto error_out; } */ + else if (commit_before_inout > time(NULL) + 5*60) + commit_before_inout = time(NULL) + 5*60; peerhash = str2md5(peername); /* static buffer */ if (store_user(ctx, peerhash, peername)) { @@ -503,9 +505,21 @@ int glite_jppsbe_start_upload( } free(stmt); stmt = NULL; + trio_asprintf(&stmt,"delete from files where jobid = '%|Ss' and state = 'uploading' and deadline < %s", ju, glite_jp_db_timetodb(time(NULL))); + if (!stmt) { + err.code = ENOMEM; + goto error_out; + } + if (glite_jp_db_execstmt(ctx, stmt, NULL) < 0) { + err.code = EIO; + err.desc = "DB access failed"; + goto error_out; + } + + free(stmt); stmt = NULL; trio_asprintf(&stmt,"insert into files" "(jobid,filename,int_path,ext_url,state,deadline,ul_userid) " - "values ('%|Ss','%|Ss','%|Ss','%|Ss','%|Ss', '%|Ss', '%|Ss')", + "values ('%|Ss','%|Ss','%|Ss','%|Ss','%|Ss', %s, '%|Ss')", ju, data_basename, data_fname, *destination_out, "uploading", glite_jp_db_timetodb(*commit_before_inout), peerhash); if (!stmt) { @@ -523,7 +537,7 @@ int glite_jppsbe_start_upload( } goto error_out; } - + error_out: free(db_row[0]); free(db_row[1]); free(stmt);