Skip to content

Commit

Permalink
Make the "celery" queue the default instead of "schema" to stay backw…
Browse files Browse the repository at this point in the history
…ard-compatible.

Fix #3325.
  • Loading branch information
jezdez committed Mar 5, 2019
1 parent bc22797 commit 28d933c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
1 change: 1 addition & 0 deletions redash/settings/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def all_settings():
QUERY_RESULTS_CLEANUP_MAX_AGE = int(os.environ.get("REDASH_QUERY_RESULTS_CLEANUP_MAX_AGE", "7"))

SCHEMAS_REFRESH_SCHEDULE = int(os.environ.get("REDASH_SCHEMAS_REFRESH_SCHEDULE", 30))
SCHEMAS_REFRESH_QUEUE = os.environ.get("REDASH_SCHEMAS_REFRESH_QUEUE", "celery")

AUTH_TYPE = os.environ.get("REDASH_AUTH_TYPE", "api_key")
ENFORCE_HTTPS = parse_boolean(os.environ.get("REDASH_ENFORCE_HTTPS", "false"))
Expand Down
2 changes: 1 addition & 1 deletion redash/tasks/queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ def refresh_schemas():
elif ds.org.is_disabled:
logger.info(u"task=refresh_schema state=skip ds_id=%s reason=org_disabled", ds.id)
else:
refresh_schema.apply_async(args=(ds.id,), queue="schemas")
refresh_schema.apply_async(args=(ds.id,), queue=settings.SCHEMAS_REFRESH_QUEUE)

logger.info(u"task=refresh_schemas state=finish total_runtime=%.2f", time.time() - global_start_time)

Expand Down
6 changes: 2 additions & 4 deletions tests/tasks/test_refresh_schemas.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import datetime

from mock import ANY, call, patch
from mock import patch
from tests import BaseTestCase

from redash.tasks import refresh_schemas


class TestRefreshSchemas(BaseTestCase):
def test_calls_refresh_of_all_data_sources(self):
self.factory.data_source # trigger creation
self.factory.data_source # trigger creation
with patch('redash.tasks.queries.refresh_schema.apply_async') as refresh_job:
refresh_schemas()
refresh_job.assert_called()
Expand Down

0 comments on commit 28d933c

Please sign in to comment.