/* * Sets the default timeout used by request timer. * * @example Sets the default timeout * Groonga::RequestTimer.default_timeout = 2.9 * * @overload default_timeout=(timeout) * @return [Float] The default timeout used by request timer. If * `timeout` is `0.0`, the default timeout is disabled. * @return [void] * * @since 6.0.2 */ static VALUE rb_grn_request_timer_s_set_default_timeout (VALUE module, VALUE rb_timeout) { double timeout; timeout = NUM2DBL(rb_timeout); grn_set_default_request_timeout(timeout); return Qnil; }
static ngx_int_t ngx_http_groonga_context_init(ngx_http_groonga_loc_conf_t *location_conf, ngx_pool_t *pool, ngx_log_t *log) { ngx_int_t status; if (location_conf == ngx_http_groonga_current_location_conf) { return NGX_OK; } status = ngx_http_groonga_context_init_logger(location_conf, pool, log); if (status == NGX_ERROR) { return status; } status = ngx_http_groonga_context_init_query_logger(location_conf, pool, log); if (status == NGX_ERROR) { return status; } grn_ctx_use(context, location_conf->database); grn_cache_current_set(context, location_conf->cache); /* TODO: It doesn't work yet. We need to implement request timeout * handler. */ if (location_conf->default_request_timeout_msec == NGX_CONF_UNSET_MSEC) { grn_set_default_request_timeout(0.0); } else { double timeout; timeout = location_conf->default_request_timeout_msec / 1000.0; grn_set_default_request_timeout(timeout); } ngx_http_groonga_current_location_conf = location_conf; return status; }