Skip to content

Marking a thread to ensure no new traffic is routed to the thread #6023

@mayursdev

Description

@mayursdev

I am running my nodejs app using pm2 in cluster mode. My requirement for pm2:

  1. mark a thread so that the load balancer doesn't route new requests to that thread but keep it running to finish any pending processes
  2. waits for x seconds
  3. reloads that thread
  4. moves to next thread in cluster and repeat.

The idea is to keep it running but not stop. Stopping will terminate any on going process in it.
By waiting for x seconds before reloading we allow it to finish any pending processes.
This approach also ensures we have to make no changes in the code.

Is it possible to create a node script which handles the requirements? It seems like a basic use case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions