Skip to content

Commit

Permalink
don't kill if pid same as file (#8997) (#8998)
Browse files Browse the repository at this point in the history
The pid file needs to be deleted.
  • Loading branch information
lewijw authored and auvipy committed May 9, 2024
1 parent 9255236 commit c251e34
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions celery/platforms.py
Expand Up @@ -188,6 +188,7 @@ def remove_if_stale(self):
return True
if pid == os.getpid():
# this can be common in k8s pod with PID of 1 - don't kill
self.remove()
return True

try:
Expand Down
2 changes: 1 addition & 1 deletion t/unit/utils/test_platforms.py
Expand Up @@ -696,7 +696,7 @@ def test_remove_if_stale_same_pid(self):
p.remove = Mock()

assert p.remove_if_stale()
p.remove.assert_not_called()
p.remove.assert_called_with()

@patch('os.fsync')
@patch('os.getpid')
Expand Down

0 comments on commit c251e34

Please sign in to comment.