datashare icon indicating copy to clipboard operation
datashare copied to clipboard

chore: extract async task lib

Open ClemDoum opened this issue 10 months ago • 0 comments

TODO

  • [ ] handle redisson version properly (try to remove the explicit version in datashare-app)
  • [ ] CI for datashare-tasks
  • [ ] JAR publication for datashare-tasks
  • [ ] validate naming (datashare-tasks vs. datashare-async-tasks)
  • [ ] review TODOs left in the code

PR description

This PRs extracts the asynchronous tasks logic of DS in its own package. The goal of the operation is that the package can be used by other repos than DS if they want to implement async tasks (neo4j proeject for instance).

Changes

datashare-app

Removed

  • removed async tasks logic and added a dependency on datashare-tasks

datashare-tasks

Added

  • created the datashare-tasks repo

Changed

  • replaced CancellableCallable by CancellableTask
  • renamed CanceledEvent into CancelledEvent
  • task function now take a progress which is only called with the Double progress argument. The String taskId part of the progress is forwarded inside the TaskRunnerLoop. This avoid the task implementer to possibly call progress(taskId, progress) with the wrong taskId.

Left for later

  • wrap task cancellation logic in its own function and keep track of the original exception is something goes wrong while handling task error
  • align Java and Python
  • decouple task name and object name as the current task mapping relies as the current task name mapping heavily relies on class naming and will prevent refactor/renaming/moving classes

ClemDoum avatar Apr 24 '24 11:04 ClemDoum