Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve live entity life cycle (#315)
* fix: Resolve issue about the onShutDown function for Live entities Add deprecated annotation on previous onShutDown extension method Add onShutDown value in LiveEntity to apply action in event or manual case of shutdown * feat: Use coroutine dispatcher for lifecycle of live entity classes Manage the interception of events with the lifecycle of the Live entity. * feat: Use default dispatcher in constructor of live entity * chore: Remove deprecated annotation on onShutDown methods * use and extract SupervisorJob where possible * allow handling a live entity completion * Add structured concurrency to live entity (#285) * test: Begin test for LiveMessage * test: Add tests for LiveMessage class Add tests for listen events Ignore tests where the lifecycle is break by event * chore: Remove useless imports * fix: shutdown action for live entity Deprecate the listening where the live entity is shutdown because the methods are never called Create a property to apply action when the entity is shutdown * fix: Cancel live entity when kord is cancel Add parent of coroutine in constructor of AbstractLiveKordEntity to automatically cancelled the live entity when kord is cancelled * fix: Resolve issue listening for onShutdown, chore: Refactor name shutdown Rename shutDown method to shudown to agree with the method shutdown in kord Resolve issue to listening event for onShutdown action with an empty action job * test: Add abstract class to tests live entity * test: Add tests for abstract live entity and general behavior * chore: Add generic type live entity in abstract class test * chore: Deprecate onCreate method never called by entity * test: Add tests for Member, Role and User live entity Add tests for LiveMember Add tests for LiveRole Add tests for LiveUser * feat: Support BanAddEvent in live guild * test: Change test classes to simulate event and manage it * chore: Remove annotation need token bot * chore: Adapt Role & User live test with send manual event * chore: Adapt Role & User live test with send manual event * test: Add check equality field of event, implements member live test * chore: Remove optIn no used * fix: Correction tests to send fake event instead of real interaction * test: Refactor test to build test with valid and random id * fix: Fix flow issue with delay .. * fix: Rename package to resolve gradle issue I don't know why * test: Add Atomic counter to test event * test: End tests for guild live entity * chore: Place deprecated annotation on live entity Place Deprecated annotation for create event * test: Live category test * chore: Use sequence random id from other tests * test: Tests for all live entities category * test: Add Integrations update for guild live entity * fix: Add delay between creation job and send event Apply a delay between creation jobs and send events to be sure that all jobs are ready to listen the events in flow Without that, this is possible that the test failed * chore: Add deprecated annotation on GuildCreateEvent for live channel * fix: Use guild test channel type (according to GuildMessageChannel) * chore: format * chore: change package name and function name * chore: Use randomID, refactor send event * chore: Doc about shutdown action * chore: Change ReplaceWith in Deprecated annotation, rename shutdown method to shutDown * fix: Remove shutdown action property Remove the onShutDownAction and shutdownAction property to exploit the function invokeOnCompletion from job. Change constructor of live entity to be able to set final the kord instance and launch event in the scope of the live entity * feat: Add cause of shut down live entity * chore: Set deprecate level to Error * test: Add test for LiveGuild with method onGuildCreate * chore: Rename method about completion of job * feat: Add cancellation exception class for live entity Add the class LiveCancellationException to be able to retrieve the event causing the completion of live entity * feat: Add cause of cancellation to retrieve event for each live entity Use the LiveCancellationException class in parameter of shutDown method to be able to retrieve the source event for each live entity * chore: format * tests: Remove delay and use queue to manage action Remove delay between event and replace by Queue to send event when the previous event is received * tests: Add tests for LiveCancellationException constructor Check if there is an error when the exception is called with or not reason message * chore: Refactor property of LiveCancellationException * fix: Null pointer in live entities tests Remove job property, remove delay to use kord.launch and invoke the first event only when the job is ready * chore: try to add delay in tests Add delay in test to help CI * chore: Create constante for delay time in tests * chore: try old system for tests with CI * fix: Remove non-existent code * Retry github action * tests: Check data event caused shutDown Check the data into the event causing the shutDown of the live entity * Retry github action * Retry github action * Retry github action * chore: Change sentence in deprecated annotation * chore: Remove replaceWith Remove replaceWith where the code cannot be correctly generated without instance of object * chore: Homogenize cancel message * chore: Fix imports and ReplaceWith for Deprecated annotation * chore: Remove ReplaceWith for forgotten Deprecated annotation * Fix duplicate update on live entitites (#298) * fix: Resolve issue about several call update function Use the default job children in live entity to call once times the update function * chore: Remove inline doc in test * fix: Use ShareFlow to manage update method * Retry github action * chore: format * Retry github action * feat: Add possibility to define Job parent to create live entities (#304) * feat: Add possibility to define Job parent to create live entities * fix: Use CoroutineScope to define parent * feat: Allows to set CoroutineScope for each method 'on' * feat: Set coroutineScope into constructor of Live entities Change the parameters of AbstractLiveKordEntity to use coroutineScope by delegation * Reload Github workflow * fix: Use kord.coroutineContext to build default CoroutineScope for live entities * Fix compilation issues * tests: Remove test file (#319) * inline supervisor job Co-authored-by: Distractic <distractic@outlook.fr> Co-authored-by: Distractic <46402441+Distractic@users.noreply.github.com>
- Loading branch information