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

Feat: Handling messages limit based on messages size #32

Merged
merged 10 commits into from
Nov 8, 2024

Conversation

gabrielmatau79
Copy link
Contributor

The addMessage method implements the calculation of message size only (payload) in bytes for storage. Additionally, a constraint is implemented in the takeFromQueue function to return the number of messages that occupy up to 1 MB by default, which can also be configurable.

@gabrielmatau79 gabrielmatau79 self-assigned this Nov 6, 2024
@gabrielmatau79 gabrielmatau79 marked this pull request as ready for review November 7, 2024 15:11
Copy link
Contributor

@genaris genaris left a comment

Choose a reason for hiding this comment

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

Some minor suggestions about naming to make it more aligned with specs in the DIDComm world.

Also we would need to update the client to allow sending this new limitBytes parameter in takeFromQueue. A simple way I'm thinking of is about adding a maxReceiveBytes?: number in MessagePickupRepositoryClient constructor:

constructor(options: { private readonly url: string, private readonly maxReceiveBytes?: number}) {}

And pass this.maxReceiveBytes when calling the RPC method. Of course, this is not ideal but it is a solution to support it without requiring any modification into credo-ts and its MessagePickupRepository interface.

gabrielmatau79 and others added 6 commits November 8, 2024 09:54
- Modified the constructor of `MessagePickupRepositoryClient` to accept a single `options` object. - Refactored `url` and `maxReceiveBytes` to be properties within the `options` object for more flexible parameter handling. - Ensured `url` and `maxReceiveBytes` remain `readonly` properties in the class.
@genaris genaris merged commit 0dc06f2 into main Nov 8, 2024
4 checks passed
@genaris genaris deleted the feat/handling-messages-limit-based-on-messages-size branch November 8, 2024 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants