Project

General

Profile

Development #57019

implémenter notre propre uwsgidecorators

Added by Benjamin Dauvergne about 1 month ago. Updated 24 days ago.

Status:
Solution proposée
Priority:
Normal
Category:
-
Target version:
-
Start date:
16 Sep 2021
Due date:
% Done:

0%

Estimated time:
Patch proposed:
Yes
Planning:
No

Description

Parce que celui upstream me fait peur.


Files

History

#1

Updated by Benjamin Dauvergne about 1 month ago

#3

Updated by Benjamin Dauvergne about 1 month ago

Voilà testé localement dans publik-devinst sur combo :

Les modifs faites localement :

diff --git a/combo/public/views.py b/combo/public/views.py
index 8be4fd1c..714ca85c 100644
--- a/combo/public/views.py
+++ b/combo/public/views.py
@@ -455,6 +455,8 @@ def empty_site(request):

 def page(request):
+    from combo.utils.spooler import coin
+    coin(1, 2, 'x' * 1000000)
     request.extra_context_data = {'absolute_uri': request.build_absolute_uri()}
     url = request.path_info
     parts = [x for x in request.path_info.strip('/').split('/') if x]
diff --git a/combo/utils/spooler.py b/combo/utils/spooler.py
index 40298ccf..377572f1 100644
--- a/combo/utils/spooler.py
+++ b/combo/utils/spooler.py
@@ -58,7 +58,7 @@ def tenantspool(func):
     if not USE_UWSGI:
         return func

-    from uwsgidecorators import spool
+    from hobo.multitenant.uwsgidecorators import spool

     @ensure_db
     @wraps(func)
@@ -71,10 +71,10 @@ def tenantspool(func):
             except Exception:
                 logger.exception('spooler: exception during %s(%s, %s)' % (func.__name__, args, kwargs))
             else:
-                logger.info('spooler: success of %s(%s, %s)' % (func.__name__, args, kwargs))
+                logger.info('spooler: success of %s(%s, %s)' % (func.__name__, repr(args)[:1024], repr(kwargs)[:1024]))

     # pass arguments as pickles
-    base_spooler = spool(pass_arguments=True)(spooler_func)
+    base_spooler = spool(spooler_func)

     @wraps(func)
     def spooler(*args, **kwargs):
@@ -99,3 +99,8 @@ def refresh_statistics_data(cell_pk):

     cell = ChartNgCell.objects.get(pk=cell_pk)
     cell.get_statistic_data(invalidate_cache=True)
+
+
+@tenantspool
+def coin(a, b, c):
+    logger.info('spooler: co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xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, {})

Aucun souci pour passer une chaîne de 1Mo.

#4

Updated by Thomas Noël about 1 month ago

Peut-être que je vais dire une bêtise, mais est-ce qu'on pourrait intégrer au passage #57023 (gestion des connexion à la DB dans les fonction spoolées) ?

#5

Updated by Benjamin Dauvergne about 1 month ago

Thomas Noël a écrit :

Peut-être que je vais dire une bêtise, mais est-ce qu'on pourrait intégrer au passage #57023 (gestion des connexion à la DB dans les fonction spoolées) ?

Oui et la gestion du tenant aussi pourquoi pas...

#6

Updated by Benjamin Dauvergne about 1 month ago

  • Status changed from Solution proposée to En cours

Ajouter ensure_db et gérer la conservation du tenant.

#7

Updated by Benjamin Dauvergne 24 days ago

En l'absence de Thomas je veux bien quelqu'un s'intéresse au sujet.

Also available in: Atom PDF