From: Adam Dickmeiss Date: Wed, 26 Nov 2014 13:38:36 +0000 (+0100) Subject: Per target timeout PAZ-981 X-Git-Tag: v1.8.4~2 X-Git-Url: http://jsfdemo.indexdata.com/cgi-bin?a=commitdiff_plain;h=194b8961ce560e233440017a65ec1758b3e6b5ec;p=pazpar2-moved-to-github.git Per target timeout PAZ-981 New setting pz:timeout which overrides z3950_operation timeout in service. --- diff --git a/doc/pazpar2_conf.xml b/doc/pazpar2_conf.xml index 4e82022..08b5a68 100644 --- a/doc/pazpar2_conf.xml +++ b/doc/pazpar2_conf.xml @@ -740,7 +740,7 @@ - + timeout @@ -761,6 +761,10 @@ z3950_operation (30) < session (60) < z3950_session (180) . The default values are given in parantheses. + + The Z39.50 operation timeout may be set per database. Refer to + . + @@ -1589,6 +1593,23 @@ + + + pz:timeout + + + Specifies timeout for operation (eg search, and fetch) for + a database. This overrides the z3650_operation timeout + that is given for a service. See . + + + + The timeout facility is supported for Pazpar2 version 1.8.4 and later. + + + + + pz:url diff --git a/etc/settings/testserver.xml b/etc/settings/testserver.xml index fdb7767..dfdffa4 100644 --- a/etc/settings/testserver.xml +++ b/etc/settings/testserver.xml @@ -1,9 +1,10 @@ - + + diff --git a/src/client.c b/src/client.c index 60553fd..ad2d2a3 100644 --- a/src/client.c +++ b/src/client.c @@ -921,11 +921,13 @@ int client_start_search(struct client *cl) const char *opt_preferred = session_setting_oneval(sdb, PZ_PREFERRED); const char *extra_args = session_setting_oneval(sdb, PZ_EXTRA_ARGS); const char *opt_present_chunk = session_setting_oneval(sdb, PZ_PRESENT_CHUNK); + const char *opt_timeout = session_setting_oneval(sdb, PZ_TIMEOUT); ZOOM_query query; char maxrecs_str[24], startrecs_str[24], present_chunk_str[24]; struct timeval tval; int present_chunk = 20; // Default chunk size int rc_prep_connection; + int operation_timeout = se->service->z3950_operation_timeout; cl->diagnostic = 0; cl->record_failures = cl->ingest_failures = cl->filtered = 0; @@ -933,12 +935,15 @@ int client_start_search(struct client *cl) yaz_gettimeofday(&tval); tval.tv_sec += 5; + if (opt_timeout && *opt_timeout) + operation_timeout = atoi(opt_timeout); + if (opt_present_chunk && strcmp(opt_present_chunk,"")) { present_chunk = atoi(opt_present_chunk); yaz_log(YLOG_DEBUG, "Present chunk set to %d", present_chunk); } rc_prep_connection = - client_prep_connection(cl, se->service->z3950_operation_timeout, + client_prep_connection(cl, operation_timeout, se->service->z3950_session_timeout, se->service->server->iochan_man, &tval); diff --git a/src/settings.c b/src/settings.c index ece8f04..85af04d 100644 --- a/src/settings.c +++ b/src/settings.c @@ -86,6 +86,7 @@ static char *hard_settings[] = { "pz:native_score", "pz:memcached", "pz:redis", + "pz:timeout", 0 }; diff --git a/src/settings.h b/src/settings.h index de43d28..cd01937 100644 --- a/src/settings.h +++ b/src/settings.h @@ -59,7 +59,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #define PZ_NATIVE_SCORE 36 #define PZ_MEMCACHED 37 #define PZ_REDIS 38 -#define PZ_MAX_EOF 39 +#define PZ_TIMEOUT 39 +#define PZ_MAX_EOF 40 struct setting {