Skip to content

Commit

Permalink
Revert "Add app context to tests"
Browse files Browse the repository at this point in the history
This reverts commit 5fd6bd6.
  • Loading branch information
stchris committed Sep 18, 2024
1 parent 068da91 commit 88c3216
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
6 changes: 1 addition & 5 deletions aleph/queues.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,9 @@ def queue_task(collection, stage, job_id=None, context=None, **payload):
)
if SETTINGS.TESTING and lock.acquire(False):
from aleph.worker import get_worker
from threading import Thread

worker = get_worker()
thread = Thread(target=lambda: worker.process(blocking=False))
thread.start()
thread.join()

worker.process(blocking=False)
lock.release()


Expand Down
9 changes: 4 additions & 5 deletions aleph/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,11 @@ def on_signal(self, signal, _):
super().on_signal(signal, _)

def process(self, blocking=True):
with app.app_context():
log.critical("Latest version")
if blocking:
if blocking:
with app.app_context():
self.process_blocking()
else:
self.process_nonblocking()
else:
self.process_nonblocking()

def periodic(self):
with app.app_context():
Expand Down

0 comments on commit 88c3216

Please sign in to comment.