Skip to content

Conversation

@adambirds
Copy link
Contributor

@adambirds adambirds commented Jul 27, 2024

Description

This PR adds a property next_run that calculates the next run time for the routine to the Routine class so that this can be exposed and used in other commands etc.

I have tested this on my own production twitch bot by installing from git and it works great.

Checklist

  • If code changes were made then they have been tested.
    • I have updated the documentation to reflect the changes. - couldn't find where to add the property. maybe auto generated from doc strings??
    • I have updated the changelog with a quick recap of my changes. - not sure which version number i would add it under.
  • This PR fixes an issue.
  • This PR adds something new (e.g. new method or parameters).
  • This PR is a breaking change (e.g. methods or parameters removed/renamed)
  • This PR is not a code change (e.g. documentation, README, ...)
  • I have read and agree to the Developer Certificate of Origin for this contribution

@adambirds
Copy link
Contributor Author

Is this able to be merged now? I have had this running for a few weeks now without an issue by installing direct from my branch but would be good to get merged.

@adambirds
Copy link
Contributor Author

@chillymosh can this be merged?

@EvieePy
Copy link
Member

EvieePy commented Sep 1, 2024

@chillymosh can this be merged?

I will test it now

@EvieePy
Copy link
Member

EvieePy commented Sep 1, 2024

Ideally this would be a method, not a property. Logic after some testing works fine though

return self._start_time

@property
def next_run(self) -> Optional[datetime.datetime]:
Copy link
Member

Choose a reason for hiding this comment

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

Not sure why it's optional? It doesn't appear the return would ever be optional

if next_run < now:
next_run = now + datetime.timedelta(seconds=self._delta)

return next_run
Copy link
Member

Choose a reason for hiding this comment

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

I'll have to check but this looks like it may have potential for next_run to never be defined.

@EvieePy EvieePy mentioned this pull request Jan 27, 2025
8 tasks
@EvieePy EvieePy closed this in #480 Jan 27, 2025
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.

3 participants