Skip to content

Force post notification job callback to static lifetime#357

Merged
MeirShpilraien merged 1 commit into
masterfrom
post_notification_job_static_lifetime
Jul 25, 2023
Merged

Force post notification job callback to static lifetime#357
MeirShpilraien merged 1 commit into
masterfrom
post_notification_job_static_lifetime

Conversation

@MeirShpilraien
Copy link
Copy Markdown

Post notification job callback is kept by Redis for unknown time and so we must force it live for the static lifetime. Notice that this does not mean that the value must live forever, it just means that it can not hold any none static references. For more information: https://practice.rs/lifetime/static.html#t-static

@MeirShpilraien MeirShpilraien requested a review from iddm July 25, 2023 07:13
Copy link
Copy Markdown
Contributor

@iddm iddm left a comment

Choose a reason for hiding this comment

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

Looks fine, but is this needed just for RedisGears/RedisGears#1001 ?

@MeirShpilraien
Copy link
Copy Markdown
Author

No, its needed in general, the API today is wrong. The callback can borrow references to object that will be free before the callback is called.

@MeirShpilraien MeirShpilraien merged commit e791067 into master Jul 25, 2023
@MeirShpilraien MeirShpilraien deleted the post_notification_job_static_lifetime branch July 25, 2023 08:00
@github-actions github-actions Bot mentioned this pull request May 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants