Skip to content

Commit

Permalink
fix(remove): change error message when job is locked (python) (#2175)
Browse files Browse the repository at this point in the history
  • Loading branch information
roggervalf authored Sep 12, 2023
1 parent c389221 commit 2f5628f
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 31 deletions.
2 changes: 0 additions & 2 deletions docs/gitbook/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
### Features

* **connection:** provide skipVersionCheck option for shared connections ([#2149](https://github.com/taskforcesh/bullmq/issues/2149)) ref [#2148](https://github.com/taskforcesh/bullmq/issues/2148) ([914820f](https://github.com/taskforcesh/bullmq/commit/914820f720cbc48b49f4bd1c46d148eb2bb5b79c))
* **python:** add addBulk method in queue class ([#2161](https://github.com/taskforcesh/bullmq/issues/2161)) ([555dd44](https://github.com/taskforcesh/bullmq/commit/555dd44a0190f4957e43f083e2f59d7f58b90ac9))
* **python:** add flow producer class ([#2115](https://github.com/taskforcesh/bullmq/issues/2115)) ([14a769b](https://github.com/taskforcesh/bullmq/commit/14a769b193d97576ff9b3f2a65de47463ba04ffd))

# [4.8.0](https://github.com/taskforcesh/bullmq/compare/v4.7.4...v4.8.0) (2023-08-20)

Expand Down
19 changes: 2 additions & 17 deletions docs/gitbook/python/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,14 @@
## v1.13.0 (2023-09-07)
### Feature
* **flow-producer:** Add addBulk method (python) ([#2174](https://github.com/taskforcesh/bullmq/issues/2174)) ([`c67dfb4`](https://github.com/taskforcesh/bullmq/commit/c67dfb49931ee4cb96573af660e9f2316942687c))
* **connection:** Provide skipVersionCheck option for shared connections (#2149) ref #2148 ([`914820f`](https://github.com/taskforcesh/bullmq/commit/914820f720cbc48b49f4bd1c46d148eb2bb5b79c))

### Documentation
* **auto-removal:** Clarify removal regardless of job names ([`bab0c61`](https://github.com/taskforcesh/bullmq/commit/bab0c6168f22af4e6aa7e9c47ecaad226d8fbf1d))
* **python:** Add flowProducer usage ([#2163](https://github.com/taskforcesh/bullmq/issues/2163)) ([`96f84b7`](https://github.com/taskforcesh/bullmq/commit/96f84b7efb4d187ddeab3169c833c35e7786e608))

## v1.12.0 (2023-08-31)
### Feature
* **python:** Add addBulk method in queue class ([#2161](https://github.com/taskforcesh/bullmq/issues/2161)) ([`555dd44`](https://github.com/taskforcesh/bullmq/commit/555dd44a0190f4957e43f083e2f59d7f58b90ac9))

### Documentation
* **typedoc:** Change defaultValue tag styling ([#2160](https://github.com/taskforcesh/bullmq/issues/2160)) ([`1b0ff8e`](https://github.com/taskforcesh/bullmq/commit/1b0ff8ef51e27df906a93dae317534e2c2e9ccb3))
* **queue:** Add addBulk method ([#2161](https://github.com/taskforcesh/bullmq/issues/2161)) ([`555dd44`](https://github.com/taskforcesh/bullmq/commit/555dd44a0190f4957e43f083e2f59d7f58b90ac9))

## v1.11.0 (2023-08-26)
### Feature
* **python:** Add flow producer class ([#2115](https://github.com/taskforcesh/bullmq/issues/2115)) ([`14a769b`](https://github.com/taskforcesh/bullmq/commit/14a769b193d97576ff9b3f2a65de47463ba04ffd))
* **sandbox:** Emulate moveToDelayed method (#2122) ref #2118 ([`4c4559b`](https://github.com/taskforcesh/bullmq/commit/4c4559b3c678313b3727c9781a6d3f963bcfda4e))

### Fix
* **sandbox:** Ignore extra params on processor ([#2142](https://github.com/taskforcesh/bullmq/issues/2142)) ([`3602c20`](https://github.com/taskforcesh/bullmq/commit/3602c20ab80cbe0a0d3de66210a01ad119e1090b))

### Documentation
* **rate-limit:** Add getRateLimitTtl usage ([#2116](https://github.com/taskforcesh/bullmq/issues/2116)) ([`51219fd`](https://github.com/taskforcesh/bullmq/commit/51219fd8685ccf1703548dda49303cd03690a95e))
* Add flow producer class ([#2115](https://github.com/taskforcesh/bullmq/issues/2115)) ([`14a769b`](https://github.com/taskforcesh/bullmq/commit/14a769b193d97576ff9b3f2a65de47463ba04ffd))

## v1.10.1 (2023-08-19)
### Fix
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@
{
"releaseRules": [
{
"message": "*[python]*",
"message": "*\\[python\\]*",
"release": false
}
]
Expand Down
2 changes: 1 addition & 1 deletion python/bullmq/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ async def remove(self, opts: dict = {}):
removed = await self.scripts.remove(self.id, opts.get("removeChildren", True))

if not removed:
raise Exception(f"Could not remove job {self.id}")
raise Exception(f"Job {self.id} could not be removed because it is locked by another worker")

async def moveToFailed(self, err, token:str, fetchNext:bool = False):
error_message = str(err)
Expand Down
4 changes: 3 additions & 1 deletion src/classes/job.ts
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,9 @@ export class Job<
if (removed) {
queue.emit('removed', job);
} else {
throw new Error('Could not remove job ' + job.id);
throw new Error(
`Job ${this.id} could not be removed because it is locked by another worker`,
);
}
}

Expand Down
8 changes: 0 additions & 8 deletions src/commands/removeJob-1.lua
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,6 @@ local function removeJob( prefix, jobId, parentKey, removeChildren)

rcall("DEL", jobKey, jobKey .. ":logs", jobKey .. ":dependencies", jobKey .. ":processed")

-- -- delete keys related to rate limiter
-- local limiterIndexTable = KEYS[10] .. ":index"
-- local limitedSetKey = rcall("HGET", limiterIndexTable, jobId)
-- if limitedSetKey then
-- rcall("SREM", limitedSetKey, jobId)
-- rcall("HDEL", limiterIndexTable, jobId)
-- end

rcall("XADD", prefix .. "events", "*", "event", "removed", "jobId", jobId, "prev", prev);
end

Expand Down
2 changes: 1 addition & 1 deletion tests/test_flow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3079,7 +3079,7 @@ describe('flows', () => {
expect(await (nextJob as Job).getState()).to.be.equal('active');

await expect(tree.job.remove()).to.be.rejectedWith(
`Could not remove job ${tree.job.id}`,
`Job ${tree.job.id} could not be removed because it is locked by another worker`,
);

expect(await tree.job.getState()).to.be.equal('waiting-children');
Expand Down

0 comments on commit 2f5628f

Please sign in to comment.