mirror of
https://github.com/django-q2/django-q2.git
synced 2026-10-04 17:58:11 +08:00
Disque: If retry is 0 , explicitly set replicate to 1
This commit is contained in:
@@ -7,8 +7,9 @@ from django_q.conf import Conf
|
|||||||
class Disque(Broker):
|
class Disque(Broker):
|
||||||
|
|
||||||
def enqueue(self, task):
|
def enqueue(self, task):
|
||||||
|
retry = Conf.RETRY if Conf.RETRY > 0 else '{} REPLICATE 1'.format(Conf.RETRY)
|
||||||
return self.connection.execute_command(
|
return self.connection.execute_command(
|
||||||
'ADDJOB {} {} 500 RETRY {}'.format(self.list_key, task, Conf.RETRY)).decode()
|
'ADDJOB {} {} 500 RETRY {}'.format(self.list_key, task, retry)).decode()
|
||||||
|
|
||||||
def dequeue(self):
|
def dequeue(self):
|
||||||
task = self.connection.execute_command('GETJOB TIMEOUT 1000 FROM {}'.format(self.list_key))
|
task = self.connection.execute_command('GETJOB TIMEOUT 1000 FROM {}'.format(self.list_key))
|
||||||
|
|||||||
Reference in New Issue
Block a user