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

waitForServices times out after the first interval is reached since 0.14.22 #1123

Closed
4 tasks done
rochdev opened this issue Aug 15, 2022 · 2 comments
Closed
4 tasks done

Comments

@rochdev
Copy link

rochdev commented Aug 15, 2022

Prerequisites

  • I am running the latest version
  • I checked the documentation and found no answer
  • I checked to make sure that this issue has not already been filed
  • I'm reporting the issue to the correct repository

Current Behavior

waitForServices times out after the first interval is reached.

Expected Behavior

waitForServices should retry indefinitely unless a timeout is explicitly configured, which was the behavior before 0.14.22 and is also the documented behavior.

Failure Information

Steps to Reproduce

  1. Create two ServiceBroker instances.
  2. Start both brokers.
  3. Call waitForServices on one of the brokers with the name of the other broker, with the default timeout and interval.
  4. Wait 1 second.

Reproduce code snippet

const port = 51817
const broker = new ServiceBroker({
  namespace: 'multi',
  nodeID: `server-${process.pid}`,
  logger: false,
  transporter: `tcp://127.0.0.1:${port}/server-${process.pid}`
})

broker.createService({
  name: 'math',
  actions: {
    add (ctx) {
      const numerify = this.actions.numerify

      return numerify(ctx.params.a) + numerify(ctx.params.b)
    },

    numerify (ctx) {
      return Number(ctx.params)
    }
  }
})

const clientBroker = new ServiceBroker({
  namespace: 'multi',
  nodeID: `client-${process.pid}`,
  logger: false,
  transporter: {
    type: 'TCP',
    options: {
      udpDiscovery: false,
      urls: [
        `127.0.0.1:${port}/server-${process.pid}`
      ]
    }
  }
})

broker.start()
clientBroker.start()

clientBroker.waitForServices('math')

Context

Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.

  • Moleculer version: 0.14.12
  • NodeJS version: 16.15.1
  • Operating System: macOS 12.5

Failure Logs

MoleculerServerError: Services waiting is timed out.
@icebob
Copy link
Member

icebob commented Aug 15, 2022

Thanks the report, it was a wrong variable issue, but fixed.

@icebob
Copy link
Member

icebob commented Aug 16, 2022

Released as 0.14.23

@icebob icebob closed this as completed Aug 16, 2022
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