-
Notifications
You must be signed in to change notification settings - Fork 178
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(storage): use keep config for trim() method in database storage #395
Conversation
@fabpl, any particular reason why you want to keep less than a weeks worth of data in storage? |
@@ -124,15 +124,16 @@ public function store(Collection $items): void | |||
public function trim(): void | |||
{ | |||
$now = CarbonImmutable::now(); | |||
$keep = $this->config->get('pulse.ingest.trim.keep'); |
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 probably need to introduce a custom storage key here: pulse.storage.keep
Then we need to decide if we fallback to the ingest value if the storage value is not specified.
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.
Hi @timacdonald, we thought about that because the pulse.ingest.trim.lottery key is already used in the case of DatabaseStorage, so why not use the pulse.ingest.trim.keep too, to customize if we want to keep the data longer ? Or as you said, create a new key in the storage config part.
Line 310 in 419a9bf
$odds = $this->app->make('config')->get('pulse.ingest.trim.lottery') ?? $this->app->make('config')->get('pulse.ingest.trim_lottery'); |
Hi @timacdonald, |
@fabpl, not necessarily. On Forge, we want to limit the Redis ingest to 24 hours while we want to keep 30 days in the database. This ensures that if the Can you share what specific problem you are experiencing that this PR is hoping to solve for your application? |
I've no specific problem. |
Gotcha. Because your ingest is often an in-memory system, like Redis, it can often fall over if the queue:work command was to go down, simply because it is restricted to memory limits. Where as the final storage destination, a database, is designed to hold much more information - so we don't trim the storage data until it is outside the window |
That makes sense. Thanks @timacdonald for the explanation |
Like Redis Ingest, use keep config key in database storage trim() functionality.