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

StoreTimeout hangs issue #20

Closed
skif48 opened this issue Jul 9, 2019 · 1 comment
Closed

StoreTimeout hangs issue #20

skif48 opened this issue Jul 9, 2019 · 1 comment

Comments

@skif48
Copy link

skif48 commented Jul 9, 2019

Hi, thanks for this awesome thing!
Seems like I found a bug with storeTimeout. I'm using Jest and have the following hooks:

 beforeAll(async () => {
    const serverConfig = {
      port: 9000,
      host: 'localhost',
      storage: 'RAM',
      storeTimeout: 10,
    };

    tgServer = new TelegramServer(serverConfig);

    await tgServer.start();
  });

  afterAll(async () => {
    await tgServer.stop();
  });

I keep getting such errors:

Jest did not exit one second after the test run has completed.

This usually means that there are asynchronous operations that weren't stopped in your tests. Consider running Jest with `--detectOpenHandles` to troubleshoot this issue.

I found an issue here, which is 1.5 years old, about the fact that it takes time for express to stop and that it was fixed in v1.0.1. However, the amount of time Jest has to wait is actually equal to the amount of seconds I provide to storeTimeout key of server configs. I opened the sources and found out that you're using bluebird's Promise.delay(), which uses setTimeout() under the hood. Most likely the event loop is not empty even after you stop the server, since it has a scheduled callback to execute.

Thanks!

jehy added a commit that referenced this issue Oct 14, 2019
@jehy
Copy link
Owner

jehy commented Oct 14, 2019

Should be fixed in version 2.4.2.

@jehy jehy closed this as completed Oct 14, 2019
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