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

Making the k6/experimental/timers module part of the k6 core #3297

Closed
mstoykov opened this issue Aug 23, 2023 · 1 comment · Fixed by #3587
Closed

Making the k6/experimental/timers module part of the k6 core #3297

mstoykov opened this issue Aug 23, 2023 · 1 comment · Fixed by #3587
Assignees
Milestone

Comments

@mstoykov
Copy link
Contributor

mstoykov commented Aug 23, 2023

xk6-timers implement the very old setTimeout and co.

The module has a single open issue grafana/xk6-timers#3 and is used fairly commonly.

The functionality it provides is also needed to delay execution in ways similar to sleep but without blocking the event loop.

Blockers:

  1. setTimeout does not fire in order xk6-timers#3 - the issue should be fixed.
  2. what will be the import path k6/timers ? Do we want to actually just have it globally, given how it is usually used in JS. That will add more intercompatibility with other JS engines.

Alternatives:

While setTimeout and co are very old and known, they are not very promise/async/await friendly as they predate them.

The things that keeps poping out is delay both from

  1. deno std lib
  2. npm package
  3. a gist with a version for k6

The provided APU has the benefit of doing

// code A
await delay(10);
// code B

instead of

// code A
setTimeout( () => {
  // code B
}, 10)

But likely we should still have setTimeout and co.

@mstoykov mstoykov added the evaluation needed proposal needs to be validated or tested before fully implementing it in k6 label Aug 23, 2023
@mstoykov mstoykov added this to the TBD milestone Aug 23, 2023
@codebien
Copy link
Contributor

Feature request for having setTimeout as global #3329

@codebien codebien removed this from the TBD milestone Sep 27, 2023
@olegbespalov olegbespalov moved this to Short term - Q4 2023 in k6 open-source public roadmap Nov 29, 2023
@mstoykov mstoykov self-assigned this Jan 12, 2024
@mstoykov mstoykov added js-compat and removed evaluation needed proposal needs to be validated or tested before fully implementing it in k6 labels Jan 12, 2024
@mstoykov mstoykov changed the title Making the k6/experimental/xk6-timers module part of the k6 core Making the k6/experimental/timers module part of the k6 core Jan 25, 2024
@mstoykov mstoykov added this to the v0.50.0 milestone Jan 25, 2024
mstoykov added a commit that referenced this issue Feb 9, 2024
mstoykov added a commit that referenced this issue Feb 9, 2024
mstoykov added a commit that referenced this issue Feb 9, 2024
@andrewslotin andrewslotin moved this from Short term to Released in k6 open-source public roadmap Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging a pull request may close this issue.

2 participants