mirror of https://github.com/rq/rq.git
Fix a few concatenated strings that don't have to be (#1941)
This commit is contained in:
parent
c2bec19b09
commit
10230ff040
|
@ -893,7 +893,7 @@ class Queue:
|
||||||
kwargs (*kwargs): function kargs
|
kwargs (*kwargs): function kargs
|
||||||
"""
|
"""
|
||||||
if not isinstance(f, str) and f.__module__ == '__main__':
|
if not isinstance(f, str) and f.__module__ == '__main__':
|
||||||
raise ValueError('Functions from the __main__ module cannot be processed ' 'by workers')
|
raise ValueError('Functions from the __main__ module cannot be processed by workers')
|
||||||
|
|
||||||
# Detect explicit invocations, i.e. of the form:
|
# Detect explicit invocations, i.e. of the form:
|
||||||
# q.enqueue(foo, args=(1, 2), kwargs={'a': 1}, job_timeout=30)
|
# q.enqueue(foo, args=(1, 2), kwargs={'a': 1}, job_timeout=30)
|
||||||
|
|
|
@ -60,7 +60,7 @@ class BaseDeathPenalty:
|
||||||
|
|
||||||
class UnixSignalDeathPenalty(BaseDeathPenalty):
|
class UnixSignalDeathPenalty(BaseDeathPenalty):
|
||||||
def handle_death_penalty(self, signum, frame):
|
def handle_death_penalty(self, signum, frame):
|
||||||
raise self._exception('Task exceeded maximum timeout value ' '({0} seconds)'.format(self._timeout))
|
raise self._exception('Task exceeded maximum timeout value ({0} seconds)'.format(self._timeout))
|
||||||
|
|
||||||
def setup_death_penalty(self):
|
def setup_death_penalty(self):
|
||||||
"""Sets up an alarm signal and a signal handler that raises
|
"""Sets up an alarm signal and a signal handler that raises
|
||||||
|
|
|
@ -653,7 +653,7 @@ class BaseWorker:
|
||||||
connection: Union[Redis, 'Pipeline'] = pipeline if pipeline is not None else self.connection
|
connection: Union[Redis, 'Pipeline'] = pipeline if pipeline is not None else self.connection
|
||||||
connection.expire(self.key, timeout)
|
connection.expire(self.key, timeout)
|
||||||
connection.hset(self.key, 'last_heartbeat', utcformat(utcnow()))
|
connection.hset(self.key, 'last_heartbeat', utcformat(utcnow()))
|
||||||
self.log.debug('Sent heartbeat to prevent worker timeout. ' 'Next one should arrive in %s seconds.', timeout)
|
self.log.debug('Sent heartbeat to prevent worker timeout. Next one should arrive in %s seconds.', timeout)
|
||||||
|
|
||||||
|
|
||||||
class Worker(BaseWorker):
|
class Worker(BaseWorker):
|
||||||
|
@ -947,7 +947,7 @@ class Worker(BaseWorker):
|
||||||
if self.get_state() == WorkerStatus.BUSY:
|
if self.get_state() == WorkerStatus.BUSY:
|
||||||
self._stop_requested = True
|
self._stop_requested = True
|
||||||
self.set_shutdown_requested_date()
|
self.set_shutdown_requested_date()
|
||||||
self.log.debug('Stopping after current horse is finished. ' 'Press Ctrl+C again for a cold shutdown.')
|
self.log.debug('Stopping after current horse is finished. Press Ctrl+C again for a cold shutdown.')
|
||||||
if self.scheduler:
|
if self.scheduler:
|
||||||
self.stop_scheduler()
|
self.stop_scheduler()
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue