Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SIP-28: Background Events #150

Merged
merged 4 commits into from
Oct 14, 2024
Merged

SIP-28: Background Events #150

merged 4 commits into from
Oct 14, 2024

Conversation

ritave
Copy link
Member

@ritave ritave commented Oct 9, 2024

This PR proposes a SIP that allows a developer to schedule one-off events in the future.

@ritave ritave requested review from Montoya, ziad-saab and a team as code owners October 9, 2024 12:04
SIPS/sip-28.md Outdated Show resolved Hide resolved
SIPS/sip-28.md Outdated Show resolved Hide resolved
SIPS/sip-28.md Outdated Show resolved Hide resolved
SIPS/sip-28.md Outdated Show resolved Hide resolved

The RPC method takes two parameters:

- `date` - An [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time and optional timezone offset.
Copy link
Member

Choose a reason for hiding this comment

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

Is date preferred to letting the caller specify a number of seconds or something?

Wondering what is the simplest for developers.

Copy link
Member Author

@ritave ritave Oct 9, 2024

Choose a reason for hiding this comment

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

  • Notice that we have minute rather than second level precision.
  • Conversion to ISO strings is a single call to date.toISOString().
  • What happens to seconds when daylight time change happens?
  • What happens to seconds when user travels between timezones. local-time vs UTC distinction is an edge case here, where local-time changes while UTC one doesn't

SIPS/sip-28.md Outdated Show resolved Hide resolved
SIPS/sip-28.md Outdated Show resolved Hide resolved
SIPS/sip-28.md Outdated Show resolved Hide resolved
SIPS/sip-28.md Outdated

### Snap Manifest

This SIP introduces a new permission `endowment:background-events`. This permissions grants a Snap the ability to schedule future events.
Copy link
Member

Choose a reason for hiding this comment

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

Wondering if we should somehow merge this with cronjobs 🤔 Otherwise, we'll have two permissions that do extremely similar things 😄

Copy link
Member Author

@ritave ritave Oct 11, 2024

Choose a reason for hiding this comment

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

You mean like using endowment:cronjobs and just allowing two new RPC methods? Your call - I'm okay with either way.

Copy link
Member

Choose a reason for hiding this comment

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

WDYT @Mrtenz?

Copy link
Member

Choose a reason for hiding this comment

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

I think we eventually want to rename cronjobs to background events, but doing so will be a breaking change.

SIPS/sip-28.md Outdated Show resolved Hide resolved
SIPS/sip-28.md Outdated Show resolved Hide resolved
SIPS/sip-28.md Show resolved Hide resolved
SIPS/sip-28.md Show resolved Hide resolved
@ritave ritave merged commit f881be2 into main Oct 14, 2024
3 checks passed
@ritave ritave deleted the ritave/sip-28 branch October 14, 2024 11:25
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.

4 participants