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

Allows tick events to auto-requeue when registered as listeners #2484

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

cppcooper
Copy link
Contributor

No description provided.

Copy link
Member

@myk002 myk002 left a comment

Choose a reason for hiding this comment

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

after this change, what will the options be for cpp and lua code to handle regular callbacks? will we be able to replace repeat-util with eventful?

library/include/modules/EventManager.h Outdated Show resolved Hide resolved
@cppcooper
Copy link
Contributor Author

cppcooper commented Jan 9, 2023

after this change, what will the options be for cpp and lua code to handle regular callbacks? will we be able to replace repeat-util with eventful?

It looks as though that script could easily be replaced, yes.

edit:

As for options, cpp will have the registerTick and registerListener available for tick events. Most use cases will likely be opting for the registerListener unless they want the event to only trigger once. For example: if they need to run some clean up code.

eventful on the other hand, doesn't have tick events integrated.. but shouldn't be difficult to do.

edit2:

So I've tried to integrate tick events to eventful. It needs a bit of testing, but I believe it has all the same boilerplate the other event types have (so it should work, unless I missed something). It will only rely on the registerListener the same as the others. Of course this precludes it from the other functionality available with registerTick. So if a callback needs to happen only once, the user would then need to unregister the listener inside their callback.

- converts `freq` and `eventHandler` (i.e. the callback) to `const`
- removes the non-const `when` from the hash computation
@cppcooper cppcooper force-pushed the em-tickevents branch 2 times, most recently from 1a4914b to e2bc986 Compare March 16, 2023 19:55
@cppcooper
Copy link
Contributor Author

after this change, what will the options be for cpp and lua code to handle regular callbacks? will we be able to replace repeat-util with eventful?

As discussed on discord, there are a few technical challenges when bringing tick events to lua. So I reverted those changes.

I've included an updated channel-safely in this PR which uses the newly repeating tick events to perform some tasks. Additionally I had added a temporary event which repeated hourly and performed a test to ensure the tick listener events are refiring without any user effort. [test was successful]

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