Skip to content

Commit

Permalink
[6.0]Fix bug #5407 (#5413)
Browse files Browse the repository at this point in the history
* fix bug #5407

* optimize code
  • Loading branch information
NathanFreeman authored Jul 24, 2024
1 parent 006f870 commit 5ba0700
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/server/process.cc
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,12 @@ pid_t Factory::spawn_event_worker(Worker *worker) {
return pid;
}

// see https://github.com/swoole/swoole-src/issues/5407
if (worker->concurrency > 0 && server_->worker_num > 1) {
sw_atomic_sub_fetch(&server_->gs->concurrency, worker->concurrency);
worker->concurrency = 0;
}

if (server_->is_base_mode()) {
server_->gs->connection_nums[worker->id] = 0;
server_->gs->event_workers.main_loop(&server_->gs->event_workers, worker);
Expand Down

0 comments on commit 5ba0700

Please sign in to comment.