Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for multiple tick periods (timers). #72

Open
andytesti opened this issue Oct 17, 2024 · 1 comment
Open

Support for multiple tick periods (timers). #72

andytesti opened this issue Oct 17, 2024 · 1 comment

Comments

@andytesti
Copy link

Currently only one conceptual timer can be configured by filter instance by calling proxy_set_tick_period_milliseconds(). It implies that if multiple timers are required (i.e. multiple distinct tick_period's), the user has the responsibility to define an algorithm to decide the ideal tick period to cover all distinct tick_period's and writing the logic to demultiplex proxy_on_tick() on distinct listeners. Also the tick period lifecycle (i.e. when to erase or override the current tick_period) must be explicitly managed taking care of the multiple listeners. It seems a lot of boilerplate for a filter and looks more like an OS/platform responsibility.
WASI clocks covers that use case, but it is probably far from what proxy-wasm can provide today, since it requires complex polling types that do not fit with the proxy-wasm event-loop style.
A more conservative approach may be to introduce a third parameter return_timer_id to proxy_set_tick_period_milliseconds() to return an identifier for the timer:

proxy_set_tick_period_milliseconds

  • params:
    • i32 (uint32_t) tick_period
    • i32 (uint32_t *) return_timer_id
  • returns:
    • i32 ([proxy_status_t]) status

Additionally proxy_on_tick() could receive the timer_id as second parameter:

proxy_on_tick

  • params:
    • i32 (uint32_t) plugin_context_id
    • i32 (uint32_t ) timer_id
  • returns:
    • none

With this API the user registers a new tick_period with proxy_set_tick_period_milliseconds(), receives a timer_id, and waits for the next proxy_on_tick() related to that timer_id.

@PiotrSikora
Copy link
Member

Thanks! This is already covered by #58.

I'll be sending updates to the spec for the next ABI version over the next few days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants