Skip to content

perf(queue): deliver queued items immediately instead of waiting for the poll - #38848

Open
silverwind wants to merge 1 commit into
go-gitea:mainfrom
silverwind:fix-queue-wake
Open

perf(queue): deliver queued items immediately instead of waiting for the poll#38848
silverwind wants to merge 1 commit into
go-gitea:mainfrom
silverwind:fix-queue-wake

Conversation

@silverwind

@silverwind silverwind commented Aug 9, 2026

Copy link
Copy Markdown
Member

On an idle instance a new notification took up to 2s to reach the browser. The queue reader polled with a backoff settling at 2s, a pushed item sat until the next poll. It now wakes on push, poll kept as a fallback.

Notification badge latency: 810-1820ms before, 108-247ms after.

…the poll

LevelDB and Redis cannot notify their reader, so PopItem polled with a
backoff that settles at 2s once a queue goes idle. Every queued operation
waited for the next poll before it was even picked up.

A push now wakes the popper. PopItem reports an empty queue instead of
waiting, the single consumer does the waiting, and the poll remains only
as a fallback for items no local push announced.

Assisted-by: Claude Code:claude-opus-5
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Aug 9, 2026

@wxiaoguang wxiaoguang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The design is wrong

@GiteaBot GiteaBot added lgtm/blocked A maintainer has reservations with the PR and thus it cannot be merged and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Aug 10, 2026
@silverwind

Copy link
Copy Markdown
Member Author

Describe a better design and I will implement. This is a minor issue but was noticed during #38847.

@wxiaoguang

Copy link
Copy Markdown
Contributor

There should be no idlePollInterval in popItemByChan

popItemByChan should only call the queue's implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm/blocked A maintainer has reservations with the PR and thus it cannot be merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants