Skip to content

Commit

Permalink
fix(python): fix isPaused method when custom prefix is present (#2047)
Browse files Browse the repository at this point in the history
  • Loading branch information
roggervalf authored Jul 4, 2023
1 parent 5e2a343 commit 7ec1c5b
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 18 deletions.
11 changes: 0 additions & 11 deletions docs/gitbook/changelog.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,9 @@
# [4.2.0](https://github.com/taskforcesh/bullmq/compare/v4.1.0...v4.2.0) (2023-07-03)


### Bug Fixes

* **python:** add recommended pyproject.toml configuration ([#2029](https://github.com/taskforcesh/bullmq/issues/2029)) ([d03ffc9](https://github.com/taskforcesh/bullmq/commit/d03ffc9c98425a96d6e9dd47a6625382556a4cbf))
* **python:** nuild egg-info at the root location ([3c2d06e](https://github.com/taskforcesh/bullmq/commit/3c2d06e7e6e0944135fe6bd8045d08dd43fe7d9c))


### Features

* **common:** add option to change repeatable jobs redis key hash algorithm ([#2023](https://github.com/taskforcesh/bullmq/issues/2023)) ([ca17364](https://github.com/taskforcesh/bullmq/commit/ca17364cc2a52f6577fb66f09ec3168bbf9f1e07))
* **python:** add get job methods by state ([#2012](https://github.com/taskforcesh/bullmq/issues/2012)) ([57b2b72](https://github.com/taskforcesh/bullmq/commit/57b2b72f79afb683067d49170df5d2eed46e3712))
* **python:** add getCompleted queue method ([#2033](https://github.com/taskforcesh/bullmq/issues/2033)) ([3e9db5e](https://github.com/taskforcesh/bullmq/commit/3e9db5ef4d868f8b420e368a711c20c2568a5910))
* **python:** add getFailedCount queue method ([#2036](https://github.com/taskforcesh/bullmq/issues/2036)) ([92d7227](https://github.com/taskforcesh/bullmq/commit/92d7227bf5ec63a75b7af3fc7c312d9b4a81d69f))
* **python:** add getJobs method in queue class ([#2011](https://github.com/taskforcesh/bullmq/issues/2011)) ([8d5d6c1](https://github.com/taskforcesh/bullmq/commit/8d5d6c14442b7b967c42cb6ec3907a4d1a5bd575))
* **python:** add getJobState queue method ([#2040](https://github.com/taskforcesh/bullmq/issues/2040)) ([8ec9ed6](https://github.com/taskforcesh/bullmq/commit/8ec9ed67d2803224a3b866c51f67239a5c4b7042))

# [4.1.0](https://github.com/taskforcesh/bullmq/compare/v4.0.0...v4.1.0) (2023-06-23)

Expand Down
7 changes: 2 additions & 5 deletions docs/gitbook/python/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@

## v1.4.0 (2023-06-30)
### Feature
* **python:** Add getJobState queue method ([#2040](https://github.com/taskforcesh/bullmq/issues/2040)) ([`8ec9ed6`](https://github.com/taskforcesh/bullmq/commit/8ec9ed67d2803224a3b866c51f67239a5c4b7042))

### Documentation
* **bullmq-pro:** Update changelog ([`b71e1ca`](https://github.com/taskforcesh/bullmq/commit/b71e1ca6b3bd77557a6c1219802faaeff8768392))
* **queue:** Add getJobState method ([#2040](https://github.com/taskforcesh/bullmq/issues/2040)) ([`8ec9ed6`](https://github.com/taskforcesh/bullmq/commit/8ec9ed67d2803224a3b866c51f67239a5c4b7042))

## v1.3.1 (2023-06-29)
### Fix
Expand All @@ -32,7 +29,7 @@

## v1.1.0 (2023-06-23)
### Feature
* **queue:** Add getJobs method in queue class ([#2011](https://github.com/taskforcesh/bullmq/issues/2011)) ([`8d5d6c1`](https://github.com/taskforcesh/bullmq/commit/8d5d6c14442b7b967c42cb6ec3907a4d1a5bd575))
* **queue:** Add getJobs method ([#2011](https://github.com/taskforcesh/bullmq/issues/2011)) ([`8d5d6c1`](https://github.com/taskforcesh/bullmq/commit/8d5d6c14442b7b967c42cb6ec3907a4d1a5bd575))

## v1.0.0 (2023-06-21)
### Breaking
Expand Down
2 changes: 1 addition & 1 deletion python/bullmq/queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ async def isPaused(self):
"""
Returns true if the queue is currently paused.
"""
paused_key_exists = await self.client.hexists(self.opts.get("prefix", f"bull:{self.name}:meta"), "paused")
paused_key_exists = await self.client.hexists(f"{self.prefix}:{self.name}:meta", "paused")
return paused_key_exists == 1

async def obliterate(self, force: bool = False):
Expand Down
30 changes: 30 additions & 0 deletions python/tests/queue_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,36 @@ async def test_add_job_with_options(self):

await queue.close()

async def test_is_paused(self):
queue = Queue(queueName)
await queue.pause()
isPaused = await queue.isPaused()

self.assertEqual(isPaused, True)

await queue.resume()

isPaused = await queue.isPaused()

self.assertEqual(isPaused, False)

await queue.close()

async def test_is_paused_with_custom_prefix(self):
queue = Queue(queueName, {}, {"prefix": "test"})
await queue.pause()
isPaused = await queue.isPaused()

self.assertEqual(isPaused, True)

await queue.resume()

isPaused = await queue.isPaused()

self.assertEqual(isPaused, False)

await queue.close()

async def test_trim_events_manually(self):
queue = Queue(queueName)
await queue.add("test", data={}, opts={})
Expand Down
1 change: 0 additions & 1 deletion src/commands/includes/moveJobFromPriorityToActive.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@ local function moveJobFromPriorityToActive(priorityKey, activeKey, priorityCount
rcall("DEL", priorityCounterKey)
end
end

1 change: 1 addition & 0 deletions tests/test_repeat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1010,6 +1010,7 @@ describe('repeat', function () {
resolve();
}
} catch (error) {
console.log(error);
reject(error);
}
});
Expand Down

0 comments on commit 7ec1c5b

Please sign in to comment.