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

Fix abort handling #245

Merged
merged 3 commits into from
Feb 10, 2024
Merged

Fix abort handling #245

merged 3 commits into from
Feb 10, 2024

Conversation

timursevimli
Copy link
Member

  • tests and linter show no problems (npm t)
  • tests are added/updated for bug fixes and new features
  • code is properly formatted (npm run fmt)
  • description of changes is added in CHANGELOG.md
  • update .d.ts typings

Copy link
Contributor

@axbuglak axbuglak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After this fix, default values will be used after all abort signals. So we should check if this is a signal from timer. I think it might look something like that. And we already have one test for timeout, so maybe it would be better to just add dc.signal.addEventListener('abort' to it?

lib/collector.js Show resolved Hide resolved
lib/collector.js Show resolved Hide resolved
@timursevimli
Copy link
Member Author

timursevimli commented Jan 11, 2024

After this fix, default values will be used after all abort signals. So we should check if this is a signal from timer. I think it might look something like that. And we already have one test for timeout, so maybe it would be better to just add dc.signal.addEventListener('abort' to it?

Thanks for the suggestions! Indeed, a timeout test already exists, but I missed it. I think we can follow your suggestion by adding dc.signal.addEventListener('abort', (reason) => { ... }) to the existing test instead of two almost identical tests with timeouts.

I'm not sure if we should handle the this.#default() method differently. What I mean is that if the error is caused by a timeout, call this method, and if the error occurs due to some other reason, then do not call it. I believe this is not correct behavior.

@tshemsedinov What do you think about it? Should the handling of the this.#default() method be different depending on the reasons for the error?

@tshemsedinov tshemsedinov merged commit 2077605 into metarhia:master Feb 10, 2024
10 checks passed
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

Successfully merging this pull request may close these issues.

3 participants