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

on cluster,it will be double run #328

Open
2 tasks done
wintsa123 opened this issue Feb 22, 2025 · 3 comments
Open
2 tasks done

on cluster,it will be double run #328

wintsa123 opened this issue Feb 22, 2025 · 3 comments

Comments

@wintsa123
Copy link

wintsa123 commented Feb 22, 2025

Prerequisites

  • I have searched existing issues to ensure the issue has not already been raised
  • I have written a descriptive issue title

Issue

i use redis lock to fix it,but i wan to know some beautiful function

@mcollina
Copy link
Member

Thanks for reporting!

Can you provide steps to reproduce? We often need a reproducible example, e.g. some code that allows someone else to recreate your problem by just copying and pasting it. If it involves more than a couple of different file, create a new repository on GitHub and add a link to that.

@wintsa123
Copy link
Author

i am nestjs,use fastify。

if (cluster.isPrimary) {
  // 如果是主进程,fork 子进程
  Logger.log(`Master process is running with PID ${process.pid}`);

  // 根据 CPU 核心数来启动多个工作进程
  for (let i = 0; i < numCPUs; i++) {
    cluster.fork();
  }

  cluster.on('exit', (worker, _code, _signal) => {
    Logger.log(`Worker ${worker.process.pid} died`);
    cluster.fork()

  });

} else {
  // 如果是工作进程,启动 Nest 应用
  bootstrap();
}

i use cluster。but,socket will be double run

Thanks for reporting!

Can you provide steps to reproduce? We often need a reproducible example, e.g. some code that allows someone else to recreate your problem by just copying and pasting it. If it involves more than a couple of different file, create a new repository on GitHub and add a link to that.

@mcollina
Copy link
Member

Thanks for reporting. We do not have the resources to support Nest.js users. Please refer to the Nest Discord channel (support) for such questions.

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