Projet

Général

Profil

0001-Revert-utils-cache-warehouses-27412.patch

Valentin Deniaud, 25 novembre 2019 15:08

Télécharger (1,9 ko)

Voir les différences:

Subject: [PATCH 1/2] Revert "utils: cache warehouses (#27412)"

This reverts commit ba2c0c4fabba4d3ff71dde36ede01c812bc73282.
 bijoe/utils.py    | 4 ----
 tests/conftest.py | 2 --
 2 files changed, 6 deletions(-)
bijoe/utils.py
19 19
import json
20 20

  
21 21
from django.conf import settings
22
from django.core.cache import cache
23 22
from django.db import connection
24 23
from django.utils.translation import ugettext as _
25 24

  
......
27 26

  
28 27

  
29 28
def get_warehouses():
30
    if cache.get('warehouses_cache'):
31
        return cache.get('warehouses_cache')
32 29
    warehouses = []
33 30
    for pattern in settings.BIJOE_SCHEMAS:
34 31
        for path in glob.glob(pattern):
......
37 34
        pattern = os.path.join(connection.tenant.get_directory(), 'schemas', '*.model')
38 35
        for path in glob.glob(pattern):
39 36
            warehouses.append(Warehouse.from_json(json.load(open(path))))
40
    cache.set('warehouses_cache', warehouses, 30)
41 37
    return warehouses
42 38

  
43 39

  
tests/conftest.py
15 15

  
16 16
from django.db import connection
17 17
from django.contrib.auth.models import User
18
from django.core.cache import cache
19 18
from django.core.management import call_command
20 19

  
21 20

  
......
53 52
def load_schema_db(schema):
54 53
    import random
55 54

  
56
    cache.delete('warehouses_cache')
57 55
    database_name = 'db%s' % random.getrandbits(20)
58 56
    tmpdir = tempfile.mkdtemp()
59 57
    bijoe_schema_dir = os.path.join(tmpdir, 'schemas')
60
-