From df540af8b890caa35cd249bde94d014e7db351e5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ale=C5=A1=20K=C5=99enek?= Date: Fri, 4 May 2007 13:11:53 +0000 Subject: [PATCH] poor-man short persistence of feeds --- org.glite.jp.primary/src/is_client.c | 50 +++++++++++++++++++++++++++++++++--- 1 file changed, 46 insertions(+), 4 deletions(-) diff --git a/org.glite.jp.primary/src/is_client.c b/org.glite.jp.primary/src/is_client.c index c4ad7c7..13c65c6 100644 --- a/org.glite.jp.primary/src/is_client.c +++ b/org.glite.jp.primary/src/is_client.c @@ -6,6 +6,7 @@ #include #include + #undef SOAP_FMAC1 #define SOAP_FMAC1 static @@ -30,6 +31,9 @@ #include "glite/jp/ws_fault.c" #include "soap_util.c" +#define MAX_RETRY 10 +#define RETRY_SLEEP 2 + extern char *server_key, *server_cert; /* XXX */ static int check_other_soap(glite_jp_context_t ctx) @@ -85,7 +89,7 @@ static struct _glite_jp_soap_env_ctx_t *keep_soap_env_ctx; glite_jp_soap_env_ctx = keep_soap_env_ctx; \ } \ -int glite_jpps_single_feed( +static int glite_jpps_single_feed_wrapped( glite_jp_context_t ctx, const char *feed, int done, @@ -107,7 +111,7 @@ int glite_jpps_single_feed( /* TODO: call JP Index server via interlogger */ - printf("feed to %s, job %s\n",destination,job); + printf("feed %s to %s, job %s\n",feed,destination,job); check_other_soap(ctx); @@ -158,7 +162,27 @@ int glite_jpps_single_feed( return err.code; } -int glite_jpps_multi_feed( + +int glite_jpps_single_feed( + glite_jp_context_t ctx, + const char *feed, + int done, + const char *destination, + const char *job, + const char *owner, + glite_jp_attrval_t const *attrs +) +{ + int retry,ret; + for (retry = 0; retry < MAX_RETRY; retry++) { + if ((ret = glite_jpps_single_feed_wrapped(ctx,feed,done,destination,job,owner,attrs)) == 0) break; + sleep(RETRY_SLEEP); + } + return ret; +} + + +static int glite_jpps_multi_feed_wrapped( glite_jp_context_t ctx, const char *feed, int done, @@ -176,7 +200,7 @@ int glite_jpps_multi_feed( enum xsd__boolean false = GLITE_SECURITY_GSOAP_FALSE; glite_jp_error_t err; - printf("multi_feed: %s\n",destination); + printf("multi_feed %s to %s\n",feed,destination); glite_jp_clear_error(ctx); memset(&err,0,sizeof err); @@ -219,3 +243,21 @@ int glite_jpps_multi_feed( return err.code; } + +int glite_jpps_multi_feed( + glite_jp_context_t ctx, + const char *feed, + int done, + int njobs, + const char *destination, + char **jobs, + char **owners, + glite_jp_attrval_t **attrs) +{ + int retry,ret; + for (retry = 0; retry < MAX_RETRY; retry++) { + if ((ret = glite_jpps_multi_feed_wrapped(ctx,feed,done,njobs,destination,jobs,owners,attrs)) == 0) break; + sleep(RETRY_SLEEP); + } + return ret; +} -- 1.8.2.3