summaryrefslogtreecommitdiffhomepage
path: root/src/http/modules/perl/nginx.xs
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2008-02-16 14:23:14 +0000
committerIgor Sysoev <igor@sysoev.ru>2008-02-16 14:23:14 +0000
commit0a0c02f58b477257dd3e7e7f62274e5671b88e8e (patch)
tree6f51ea7b1224d4b344062a3b70eb2e51f83df66f /src/http/modules/perl/nginx.xs
parent5fa1146dd5bfd68bc8212935a509edb6d2d0a4af (diff)
downloadnginx-0a0c02f58b477257dd3e7e7f62274e5671b88e8e.tar.gz
nginx-0a0c02f58b477257dd3e7e7f62274e5671b88e8e.tar.bz2
optimize $r->sleep
Diffstat (limited to 'src/http/modules/perl/nginx.xs')
-rw-r--r--src/http/modules/perl/nginx.xs12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/http/modules/perl/nginx.xs b/src/http/modules/perl/nginx.xs
index f3948e270..ea8c366df 100644
--- a/src/http/modules/perl/nginx.xs
+++ b/src/http/modules/perl/nginx.xs
@@ -934,17 +934,23 @@ sleep(r, sleep, next)
CODE:
ngx_http_request_t *r;
+ ngx_msec_t sleep;
ngx_http_perl_ctx_t *ctx;
ngx_http_perl_set_request(r);
+ sleep = SvIV(ST(1));
+
+ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
+ "perl sleep: %M", sleep);
+
ctx = ngx_http_get_module_ctx(r, ngx_http_perl_module);
- ctx->sleep = SvIV(ST(1));
ctx->next = SvRV(ST(2));
- ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
- "perl sleep: %d", ctx->sleep);
+ ngx_add_timer(r->connection->write, sleep);
+
+ r->write_event_handler = ngx_http_perl_sleep_handler;
void