Skip to content

Commit

Permalink
perf(time): invoke ev_now_update for time.now()
Browse files Browse the repository at this point in the history
When some event callback runs for a very long time without entering
the event loop, updating the current time is a good idea.

Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
  • Loading branch information
zhaojh329 committed Dec 10, 2023
1 parent 15475f6 commit c933577
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions time.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
static int eco_time_now(lua_State *L)
{
struct eco_context *ctx = luaL_checkudata(L, 1, ECO_CTX_MT);
ev_now_update(ctx->loop);
lua_pushnumber(L, ev_now(ctx->loop));
return 1;
}
Expand Down

0 comments on commit c933577

Please sign in to comment.