From a3f47474fbce6f29ba822dc4dfdf860b1cecafa6 Mon Sep 17 00:00:00 2001 From: Uditi Mehta Date: Thu, 29 Aug 2024 13:44:37 -0400 Subject: [PATCH] remove debugging --- framework/postcommit_tasks/handlers.py | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/framework/postcommit_tasks/handlers.py b/framework/postcommit_tasks/handlers.py index 2ef9b94bdf9..6883745ee48 100644 --- a/framework/postcommit_tasks/handlers.py +++ b/framework/postcommit_tasks/handlers.py @@ -28,38 +28,29 @@ def postcommit_celery_queue(): return _local.postcommit_celery_queue def postcommit_before_request(): - logger.warning('Initializing postcommit queues before request') _local.postcommit_queue = OrderedDict() _local.postcommit_celery_queue = OrderedDict() def postcommit_after_request(response, base_status_error_code=500): - logger.warning(f'Postcommit after request triggered with status code {response.status_code}') if response.status_code >= base_status_error_code: - logger.warning('Clearing postcommit queues due to error response') _local.postcommit_queue = OrderedDict() _local.postcommit_celery_queue = OrderedDict() return response try: if postcommit_queue(): - logger.warning(f'Processing postcommit_queue with {len(postcommit_queue())} tasks') number_of_threads = 30 # one db connection per greenlet, let's share pool = Pool(number_of_threads) for func in postcommit_queue().values(): - logger.warning(f'Spawning task {func}') pool.spawn(func) pool.join(timeout=5.0, raise_error=True) # 5 second timeout and reraise exceptions if postcommit_celery_queue(): - logger.warning(f'Processing postcommit_celery_queue with {len(postcommit_celery_queue())} tasks') if settings.USE_CELERY: for task_dict in postcommit_celery_queue().values(): task = Signature.from_dict(task_dict) - logger.warning(f'Applying async task {task}') task.apply_async() else: for task in postcommit_celery_queue().values(): - logger.warning(f'Executing task {task}') - task() task() except AttributeError as ex: @@ -95,10 +86,8 @@ def enqueue_postcommit_task(fn, args, kwargs, celery=False, once_per_request=Tru key = f'{key}:{binascii.hexlify(os.urandom(8))}' if celery and isinstance(fn, PromiseProxy): - logger.warning(f'Enqueuing celery task {fn.__name__} with key {key}') postcommit_celery_queue().update({key: fn.si(*args, **kwargs)}) else: - logger.warning(f'Enqueuing task {fn.__name__} with key {key}') postcommit_queue().update({key: functools.partial(fn, *args, **kwargs)}) handlers = { @@ -121,7 +110,6 @@ def wrapper(func): @functools.wraps(func) def wrapped(*args, **kwargs): - logger.warning(f'Wrapping function {func.__name__} for postcommit') enqueue_postcommit_task(func, args, kwargs, celery=celery, once_per_request=once_per_request) return wrapped - return wrapper + return wrapper \ No newline at end of file