diff --git a/README.md b/README.md index d57a5ca3f7..0308bbf69a 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ addon | version | maintainers | summary [base_export_async](base_export_async/) | 14.0.1.0.0 | | Asynchronous export with job queue [base_import_async](base_import_async/) | 14.0.1.0.2 | | Import CSV files in the background [export_async_schedule](export_async_schedule/) | 14.0.1.0.1 | [](https://github.com/guewen) | Generate and send exports by emails on a schedule -[queue_job](queue_job/) | 14.0.3.9.0 | [](https://github.com/guewen) | Job Queue +[queue_job](queue_job/) | 14.0.3.9.1 | [](https://github.com/guewen) | Job Queue [queue_job_batch](queue_job_batch/) | 14.0.1.0.2 | | Job Queue Batch [queue_job_context](queue_job_context/) | 14.0.1.0.1 | [](https://github.com/AshishHirapara) | Queue Job, prepare context before enqueue keys [queue_job_cron](queue_job_cron/) | 14.0.2.0.0 | | Scheduled Actions as Queue Jobs diff --git a/queue_job/README.rst b/queue_job/README.rst index b584935b2f..2027179a3b 100644 --- a/queue_job/README.rst +++ b/queue_job/README.rst @@ -7,7 +7,7 @@ Job Queue !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:c550736995bcd674f39db1d404ad20e4af86b98c8eadfe31001f70ef8dd087cd + !! source digest: sha256:5ad5d33dbc6873d731aa277b1e53152643175aba30ae399f5b5ee7c64958efa4 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Mature-brightgreen.png diff --git a/queue_job/__manifest__.py b/queue_job/__manifest__.py index c75f07c0d7..61f2640b89 100644 --- a/queue_job/__manifest__.py +++ b/queue_job/__manifest__.py @@ -2,7 +2,7 @@ { "name": "Job Queue", - "version": "14.0.3.9.0", + "version": "14.0.3.9.1", "author": "Camptocamp,ACSONE SA/NV,Odoo Community Association (OCA)", "website": "https://github.com/OCA/queue", "license": "LGPL-3", diff --git a/queue_job/jobrunner/channels.py b/queue_job/jobrunner/channels.py index 2b6f78483f..e976f36039 100644 --- a/queue_job/jobrunner/channels.py +++ b/queue_job/jobrunner/channels.py @@ -75,8 +75,7 @@ def __contains__(self, o): def add(self, o): if o is None: raise ValueError() - if o in self._removed: - self._removed.remove(o) + self._removed.discard(o) if o in self._known: return self._known.add(o) @@ -87,8 +86,7 @@ def remove(self, o): raise ValueError() if o not in self._known: return - if o not in self._removed: - self._removed.add(o) + self._removed.add(o) def pop(self): while True: @@ -104,24 +102,6 @@ def pop(self): return o -class SafeSet(set): - """A set that does not raise KeyError when removing non-existent items. - - >>> s = SafeSet() - >>> s.remove(1) - >>> len(s) - 0 - >>> s.remove(1) - """ - - def remove(self, o): - # pylint: disable=missing-return,except-pass - try: - super().remove(o) - except KeyError: - pass - - @total_ordering class ChannelJob(object): """A channel job is attached to a channel and holds the properties of a @@ -408,8 +388,8 @@ def __init__(self, name, parent, capacity=None, sequential=False, throttle=0): self.parent.children[name] = self self.children = {} self._queue = ChannelQueue() - self._running = SafeSet() - self._failed = SafeSet() + self._running = set() + self._failed = set() self._pause_until = 0 # utc seconds since the epoch self.capacity = capacity self.throttle = throttle # seconds @@ -463,8 +443,8 @@ def __str__(self): def remove(self, job): """Remove a job from the channel.""" self._queue.remove(job) - self._running.remove(job) - self._failed.remove(job) + self._running.discard(job) + self._failed.discard(job) if self.parent: self.parent.remove(job) @@ -484,8 +464,8 @@ def set_pending(self, job): """ if job not in self._queue: self._queue.add(job) - self._running.remove(job) - self._failed.remove(job) + self._running.discard(job) + self._failed.discard(job) if self.parent: self.parent.remove(job) _logger.debug("job %s marked pending in channel %s", job.uuid, self) @@ -498,7 +478,7 @@ def set_running(self, job): if job not in self._running: self._queue.remove(job) self._running.add(job) - self._failed.remove(job) + self._failed.discard(job) if self.parent: self.parent.set_running(job) _logger.debug("job %s marked running in channel %s", job.uuid, self) @@ -507,7 +487,7 @@ def set_failed(self, job): """Mark the job as failed.""" if job not in self._failed: self._queue.remove(job) - self._running.remove(job) + self._running.discard(job) self._failed.add(job) if self.parent: self.parent.remove(job) diff --git a/queue_job/static/description/index.html b/queue_job/static/description/index.html index f306c8d947..1f96e22622 100644 --- a/queue_job/static/description/index.html +++ b/queue_job/static/description/index.html @@ -367,7 +367,7 @@
This addon adds an integrated Job Queue to Odoo.