-
Notifications
You must be signed in to change notification settings - Fork 0
Conversation
src/commonTest/kotlin/com/liftric/persisted/queue/JobManagerTests.kt
Outdated
Show resolved
Hide resolved
Todo:
Todo (postponed):
|
Allow defining exception types for repeat. Either via method or annotation ( |
Job cancellation lock blocks other cancellations |
Cancelling the scope isn't a good idea. Look into |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the general structure of it! In general it is JobScheduler
holds a TaskFactory
which knows how to deal with a given Task
. From what I am seeing right now you probably could get rid of the TaskFactory
and the Task itself could know how to instantiate itself with a given set of params. I mentioned at the top (cf. remarks in README.md) that you could describe the params via either interface
or data class
and by that give a clear definition how the params would look like. Then it could be a more generic create method which would not need a separate TaskFactory
. Although this gives more freedom in the long run, I favour simplicity. But as I am only reviewing and have not your full thoughts - and probably missing the point -, what was the main reason to introduce the TaskFactory
?
Regarding general persistence, could also be neat to have some super simple FileStorage ( |
Hm probably the simple file storage is not necessary, NSUserDefaults (on iOS) and SharedPreferences (on Android) are basically providing a persistent store for simple data (which is in the end file based). |
Hm, yeah maybe the file system would be better. I guess UserDefaults would only be a problem if the JSON becomes too big. Nevertheless, I'll persist a map in UserDefaults to know which jobs have been persisted with which job persister (the job persister will be defined with an interface, that way you can just drop in your own implementation.). |
Well, I guess I get rid of UserDefaults and persist all to disk. Do you think it's valuable to allow defining your own persister (maybe for encryption)? |
I don't know if there is any specific magic UserDefaults or SharedPreference do! IIRC UserDefaults actually just write a simple json to the Application Sandbox Folder. |
Should we proceed by merging this first implementation approach? I think we can build on this one and add future improvements in small increments, what do you think @gaebel? |
Sure, it's in a working state 👍 |
Perfect, will be merged :) |
No description provided.