add finalizer to stop worker on terminate
This commit is contained in:
parent
408c2271a6
commit
2a6c13fc5c
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -79,7 +79,7 @@ jobs:
|
||||
|
||||
- name: Django Testing project
|
||||
timeout-minutes: 6
|
||||
run: pytest
|
||||
run: pytest --junitxml=junit/test-results-${{ matrix.python-version }}.xml
|
||||
|
||||
- name: Publish Test Results
|
||||
uses: EnricoMi/publish-unit-test-result-action@v2
|
||||
|
@ -2,6 +2,7 @@ import asyncio
|
||||
import logging
|
||||
import multiprocessing
|
||||
import queue
|
||||
import weakref
|
||||
from asyncio import Task
|
||||
from dataclasses import dataclass
|
||||
from enum import Enum
|
||||
@ -49,6 +50,7 @@ class ConnectorManager:
|
||||
self._queue = multiprocessing.JoinableQueue(maxsize=settings.EXTERNAL_CONNECTORS_QUEUE_SIZE)
|
||||
self._worker = multiprocessing.Process(target=self.worker, args=(0, self._queue,), daemon=True)
|
||||
self._worker.start()
|
||||
self._finalizer = weakref.finalize(self, self.stop)
|
||||
|
||||
# Called by post save & post delete signals
|
||||
def __call__(self, instance: Any, **kwargs) -> None:
|
||||
|
Loading…
Reference in New Issue
Block a user