Unitech / Unitech/pm2

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

Open
#6,023 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
43.3k
Forks
2.7k
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no files, tests, or entry points. Start by reviewing PM2's cluster-mode and reload behavior, then trace the existing process-management commands to determine whether a worker can be drained before reload. Done means the requested per-thread sequence is supported without application code changes and is covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
cli, devops
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.