[PR #400] [MERGED] Introduce worker lease #1745

Closed
opened 2026-03-07 22:13:01 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/hibiken/asynq/pull/400
Author: @hibiken
Created: 2/17/2022
Status: Merged
Merged: 2/19/2022
Merged by: @hibiken

Base: masterHead: feat/lease


📝 Commits (10+)

  • 87218f5 Add base.LeaseKey helper function
  • d5ac1fb Update RDB.Dequeue to insert task ID to lease set
  • 01cff7c Move task deadline compute logic to processor
  • d48eac2 Update RDB methods to use lease instead of deadlines set
  • 0fb0d4f Update ListDeadlineExceeded to ListLeaseExpired
  • 86ae8ec Update recoverer to use ListLeaseExpired
  • 6974812 Add RDB.ExtendLease method
  • 92eba47 Update heartbeat goroutine to call ExtendLease on active tasks
  • 6f88c14 Add Lease type to base package
  • 53d8d05 Update RDB methods to work with lease

📊 Changes

24 files changed (+1349 additions, -615 deletions)

View changed files

📝 CHANGELOG.md (+5 -0)
📝 asynq.go (+8 -0)
📝 forwarder.go (+1 -1)
📝 heartbeat.go (+28 -2)
📝 heartbeat_test.go (+211 -24)
📝 inspector.go (+15 -3)
📝 inspector_test.go (+42 -1)
📝 internal/asynqtest/asynqtest.go (+18 -14)
📝 internal/base/base.go (+78 -9)
📝 internal/base/base_test.go (+78 -5)
📝 internal/rdb/benchmark_test.go (+12 -8)
📝 internal/rdb/inspect.go (+3 -3)
📝 internal/rdb/inspect_test.go (+1 -1)
📝 internal/rdb/rdb.go (+68 -101)
📝 internal/rdb/rdb_test.go (+375 -319)
📝 internal/testbroker/testbroker.go (+21 -12)
📝 internal/timeutil/timeutil.go (+27 -6)
internal/timeutil/timeutil_test.go (+48 -0)
📝 janitor.go (+1 -1)
📝 processor.go (+83 -48)

...and 4 more files

📄 Description

Closes #334


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/hibiken/asynq/pull/400 **Author:** [@hibiken](https://github.com/hibiken) **Created:** 2/17/2022 **Status:** ✅ Merged **Merged:** 2/19/2022 **Merged by:** [@hibiken](https://github.com/hibiken) **Base:** `master` ← **Head:** `feat/lease` --- ### 📝 Commits (10+) - [`87218f5`](https://github.com/hibiken/asynq/commit/87218f58998f70a6251bfe8641d225200e452c50) Add base.LeaseKey helper function - [`d5ac1fb`](https://github.com/hibiken/asynq/commit/d5ac1fb4d84a2693792d196b7b94e189d6c1fcc3) Update RDB.Dequeue to insert task ID to lease set - [`01cff7c`](https://github.com/hibiken/asynq/commit/01cff7ca64acc45ff16b2fd2600b116fc7b7af75) Move task deadline compute logic to processor - [`d48eac2`](https://github.com/hibiken/asynq/commit/d48eac25df21e2f0c58eee2c13da4f907a376014) Update RDB methods to use lease instead of deadlines set - [`0fb0d4f`](https://github.com/hibiken/asynq/commit/0fb0d4fe19d4326cbdb0e67ded994aa8d15d2e1e) Update ListDeadlineExceeded to ListLeaseExpired - [`86ae8ec`](https://github.com/hibiken/asynq/commit/86ae8ecb4a23deb108377b6e154f1d6ca95b5a93) Update recoverer to use ListLeaseExpired - [`6974812`](https://github.com/hibiken/asynq/commit/697481202779cfc0d7158deaccee0d2e3ccc75d3) Add RDB.ExtendLease method - [`92eba47`](https://github.com/hibiken/asynq/commit/92eba4785396af0c246470b5e6b72b0cdd08f572) Update heartbeat goroutine to call ExtendLease on active tasks - [`6f88c14`](https://github.com/hibiken/asynq/commit/6f88c14bd247750b31d7af159ac3d1b434ccd7a6) Add Lease type to base package - [`53d8d05`](https://github.com/hibiken/asynq/commit/53d8d0554a607db258975f0e6af8b64b41d6132d) Update RDB methods to work with lease ### 📊 Changes **24 files changed** (+1349 additions, -615 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+5 -0) 📝 `asynq.go` (+8 -0) 📝 `forwarder.go` (+1 -1) 📝 `heartbeat.go` (+28 -2) 📝 `heartbeat_test.go` (+211 -24) 📝 `inspector.go` (+15 -3) 📝 `inspector_test.go` (+42 -1) 📝 `internal/asynqtest/asynqtest.go` (+18 -14) 📝 `internal/base/base.go` (+78 -9) 📝 `internal/base/base_test.go` (+78 -5) 📝 `internal/rdb/benchmark_test.go` (+12 -8) 📝 `internal/rdb/inspect.go` (+3 -3) 📝 `internal/rdb/inspect_test.go` (+1 -1) 📝 `internal/rdb/rdb.go` (+68 -101) 📝 `internal/rdb/rdb_test.go` (+375 -319) 📝 `internal/testbroker/testbroker.go` (+21 -12) 📝 `internal/timeutil/timeutil.go` (+27 -6) ➕ `internal/timeutil/timeutil_test.go` (+48 -0) 📝 `janitor.go` (+1 -1) 📝 `processor.go` (+83 -48) _...and 4 more files_ </details> ### 📄 Description Closes #334 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-07 22:13:01 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/asynq#1745
No description provided.