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

Timers API: setTimeout, setInterval, clearTimeout, clearInterval #332

Closed
ppcano opened this issue Oct 4, 2017 · 1 comment
Closed

Timers API: setTimeout, setInterval, clearTimeout, clearInterval #332

ppcano opened this issue Oct 4, 2017 · 1 comment

Comments

@ppcano
Copy link
Contributor

ppcano commented Oct 4, 2017

Browsers and NodeJS provide a Timers API. k6 could also provide a k6/timers API.

  • setTimeout
  • setInterval
  • clearTimeout
  • clearInterval

The WebSocket API provides the Socket.setTimeout and Socket.setInterval methods to delay a function call while the WebSocket connection is open.

May users want to use the k6/timers API for non-WebSocket tests as well?

If yes, the k6/timers API in conjunction with an API for the WebSocket connection status would deprecate the Socket.setTimeout and Socket.setInterval.

@liclac
Copy link
Contributor

liclac commented Oct 4, 2017

To be perfectly blunt, no. Node uses an event loop, k6 uses VU iterations. An API like this would make no sense for us, like I keep saying every time someone asks for this.

The websocket API is different because it starts its own event loop inside of a VU iteration.

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