Compare commits

...

3 Commits

Author SHA1 Message Date
Arik Fraimovich
8c760c8122 Update CirlceCI config to build hotfix branch 2016-05-22 10:07:43 +03:00
Arik Fraimovich
c59edfe998 Bump version 2016-05-22 10:02:32 +03:00
Arik Fraimovich
7272953038 Fix: old task trackers were not really removed 2016-05-22 10:01:49 +03:00
4 changed files with 11 additions and 4 deletions

View File

@@ -21,7 +21,7 @@ test:
- nosetests --with-xunit --xunit-file=$CIRCLE_TEST_REPORTS/junit.xml --with-coverage --cover-package=redash tests/ - nosetests --with-xunit --xunit-file=$CIRCLE_TEST_REPORTS/junit.xml --with-coverage --cover-package=redash tests/
deployment: deployment:
github_and_docker: github_and_docker:
branch: master branch: [master, /hotfix_.*/]
commands: commands:
- make pack - make pack
- make upload - make upload

View File

@@ -12,7 +12,7 @@ from redash import settings
from redash.query_runner import import_query_runners from redash.query_runner import import_query_runners
__version__ = '0.10.0' __version__ = '0.10.1'
if settings.FEATURE_TABLES_PERMISSIONS: if settings.FEATURE_TABLES_PERMISSIONS:

View File

@@ -123,7 +123,7 @@ class QueryTaskTracker(object):
remove_count = count - keep_count remove_count = count - keep_count
keys = redis_connection.zrange(list_name, 0, remove_count - 1) keys = redis_connection.zrange(list_name, 0, remove_count - 1)
redis_connection.delete(keys) redis_connection.delete(*keys)
redis_connection.zremrangebyrank(list_name, 0, remove_count - 1) redis_connection.zremrangebyrank(list_name, 0, remove_count - 1)
return remove_count return remove_count

View File

@@ -7,8 +7,12 @@ class TestPrune(TestCase):
def setUp(self): def setUp(self):
self.list = "test_list" self.list = "test_list"
redis_connection.delete(self.list) redis_connection.delete(self.list)
self.keys = []
for score in range(0, 100): for score in range(0, 100):
redis_connection.zadd(self.list, score, 'k:{}'.format(score)) key = 'k:{}'.format(score)
self.keys.append(key)
redis_connection.zadd(self.list, score, key)
redis_connection.set(key, 1)
def test_does_nothing_when_below_threshold(self): def test_does_nothing_when_below_threshold(self):
remove_count = QueryTaskTracker.prune(self.list, 100) remove_count = QueryTaskTracker.prune(self.list, 100)
@@ -22,3 +26,6 @@ class TestPrune(TestCase):
self.assertEqual(redis_connection.zscore(self.list, 'k:99'), 99.0) self.assertEqual(redis_connection.zscore(self.list, 'k:99'), 99.0)
self.assertIsNone(redis_connection.zscore(self.list, 'k:1')) self.assertIsNone(redis_connection.zscore(self.list, 'k:1'))
for k in self.keys[0:50]:
self.assertFalse(redis_connection.exists(k))