Skip to content

Conversation

@ritave
Copy link
Contributor

@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 a team, Montoya and ziad-saab as code owners October 9, 2024 12:04

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
Contributor 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

### 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
Contributor 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.

@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.

5 participants