-
Notifications
You must be signed in to change notification settings - Fork 3
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
docs: workflows sample with a basic deduplication #9
Conversation
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public record Wallet(String id, int balance, List<String> commandIds) { |
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.
We may need to build a little bit more of robustness into this.
The list will clearly grow forever.
We can have a yet very simple implementation that do one of the following:
- cap the list to a fixed size
- each element has a time to live and we prune it each time we update the state
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 wanted to keep it simple, but maybe you are right, and commenting on possible improvements is not enough: https://github.com/akka/akka-sdk/pull/9/files#diff-366d9a64a9076550a7ad186849c2003a9410ff145905120d75cf47d7ea816350R19
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.
Yep, I saw your comment but adding a TTL is not that complicated, IMO.
We can keep it simple by just looping for the whole list and filtering out expired entries.
Pruning a large list can be optimized by keeping the items ordered by timestamp, but we can leave it out and add a comment about optimizing it.
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.
ok, check now
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.
LGTM
Nicer if we later expand to some more robust examples.
it's not a perfect deduplication mechanism but rather sth to start with