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

docs: workflows sample with a basic deduplication #9

Merged
merged 3 commits into from
Nov 21, 2024

Conversation

aludwiko
Copy link
Contributor

@aludwiko aludwiko commented Nov 20, 2024

it's not a perfect deduplication mechanism but rather sth to start with

@github-actions github-actions bot added the documentation documentation related label Nov 20, 2024
import java.util.ArrayList;
import java.util.List;

public record Wallet(String id, int balance, List<String> commandIds) {
Copy link
Member

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

Copy link
Contributor Author

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

Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, check now

Copy link
Member

@octonato octonato left a 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.

@octonato octonato merged commit 0a24ac9 into main Nov 21, 2024
24 checks passed
@octonato octonato deleted the workflow-deduplication branch November 21, 2024 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation documentation related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants