File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed
Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change 11import logging
2+ import threading
23from copy import deepcopy
34from typing import List
45
@@ -15,7 +16,13 @@ class Model(object):
1516 Base Model class, all other Models will inherit from this
1617 """
1718
18- db = connection
19+ _conn = threading .local ()
20+
21+ @property
22+ def db (self ):
23+ if not hasattr (self ._conn , "db" ):
24+ self ._conn .db = pymysql .connect (** database_config )
25+ return self ._conn .db
1926
2027 # Every model should override this with the correct table name
2128 table_name = None
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ def setup_periodic_tasks(sender, **kwargs):
3030 sender .add_periodic_task (
3131 600 , calc_search_min_max .s (), name = "Update Minimum and Maximum scores and ages for search every 10 minutes"
3232 )
33- sender .add_periodic_task (30 , random_bot_action .s (), name = "200 random bots actions" )
33+ # sender.add_periodic_task(30, random_bot_action.s(), name="200 random bots actions")
3434
3535
3636@celery .task
You can’t perform that action at this time.
0 commit comments