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

Feature: delete old messages in the eventlog after a custom interval #100

Open
frederikhors opened this issue Nov 6, 2021 · 3 comments
Open

Comments

@frederikhors
Copy link
Contributor

frederikhors commented Nov 6, 2021

I'm using your amazing project for the first time (and I'm new to Go too).

I have a doubt.

If I don't use

sseServer.AutoReplay = false

each client (also the new ones) connects to a stream and gets all the messages from the past too.

My question is: is there a limit?

Example: a client connected at 09:00 and receives 100 messages. Another connects at 10:00 and receives the 100 messages too, plus the new ones that will arrive?

Do these messages remain in memory on the server?

If so, is there a way for this not to happen and to have a maximum time after which messages are deleted from memory?

Thanks for your commitment!

@purehyperbole
Copy link
Member

purehyperbole commented Nov 6, 2021

Hey @frederikhors, welcome to the Go community!

Good question! Currently enabling stream replay will keep all messages for the life of the stream.

The current implementation does not support a way to limit this and would probably need to be re-implemented to handle deletion of older elements.

I currently don't have the time to implement this, but if you feel you are able to add this please feel free to give it a go!

@frederikhors
Copy link
Contributor Author

Currently enabling stream replay will keep all messages for the life of the stream.

Ok. This is what I meant. I don't need it for now because if any client misses some message it doesn't matter.

I verified in debugging and in fact the EventLog is never filled with AutoReplay = false. Good.

As soon as I have some time I'll try to figure out how to slowly delete the messages with AutoReplay = true. Maybe using the timestamp and TTL as you already do for sending.

If you have time you can obviously do it, I'm not taking the exclusivity! 😄

@frederikhors frederikhors changed the title One thing I don't understand about messages... Feature: delete old messages in the eventlog after a custom interval Nov 6, 2021
@codewinch
Copy link
Contributor

@frederikhors you might want to use a different method for persisting messages so that you can control that on your own.

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

No branches or pull requests

3 participants