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

Appears to leave pending timeouts after request completes successfully #202

Closed
davidmc24 opened this issue Jul 2, 2021 · 1 comment · Fixed by #240
Closed

Appears to leave pending timeouts after request completes successfully #202

davidmc24 opened this issue Jul 2, 2021 · 1 comment · Fixed by #240

Comments

@davidmc24
Copy link

davidmc24 commented Jul 2, 2021

Thank you for this library. Overall, it was easy to use and did what it needed to. I just ran into one small problem with it.

I'm working on a Node process that creates PagerDuty Events with this library. I'm currently testing some of the logic with a simple command-line script that creates the event and then completes.

My expectation was that the process would exit immediately after returning, but what I'm actually seeing is that, by default, the process doesn't exit until 30 seconds later. Through experimentation, I determined that configuring requestTimeout adjusts how long the process hangs after completion.

It seems likely that you're missing some clearTimeout calls.

Minimal script to reproduce below.

Run it like this:

  • time node index.mjs <ROUTING_KEY>
    • Expected to complete shortly after event is created, but currently runs for ~30 seconds
  • time node index.mjs <ROUTING_KEY> 1000
    • Expected to complete shortly after event is created, but currently runs for ~1 second
import {event} from '@pagerduty/pdjs';
const routing_key = process.argv[2];
const requestTimeout = process.argv[3];
console.info(`Using requestTimeout ${requestTimeout}`);
event({
  data: {
    routing_key,
    event_action: 'trigger',
    dedup_key: 'test_incident_2_88f520',
    payload: {
      summary: 'Test Event V2',
      source: 'test-source',
      severity: 'error',
    },
  },
  requestTimeout
})
  .then((event) => {console.info('Success')})
  .catch((err) => {console.error('Error', err)});
@davidmc24 davidmc24 changed the title Appears to leave hanging resources after request completes successfully Appears to leave pending timeouts after request completes successfully Jul 2, 2021
@bzmw
Copy link
Contributor

bzmw commented Jul 6, 2021

Thank you for the very well documented bug report!

We'll get to fixing this in the next few weeks.

bzmw pushed a commit that referenced this issue Sep 22, 2021
@bzmw bzmw mentioned this issue Sep 22, 2021
@bzmw bzmw closed this as completed in #240 Sep 23, 2021
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 a pull request may close this issue.

2 participants