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

expiration for storage events / files #59

Merged
merged 3 commits into from
Dec 20, 2024
Merged

Conversation

ice-cronus
Copy link
Contributor

No description provided.

@ice-cronus ice-cronus requested a review from a team as a code owner December 20, 2024 12:07
@ice-cronus ice-cronus force-pushed the bugfix/storage_expiration branch from 0d6e3cc to a456150 Compare December 20, 2024 13:26
ice-ares
ice-ares previously approved these changes Dec 20, 2024
ice-myles
ice-myles previously approved these changes Dec 20, 2024
tags as jtags;
`, params)
if err != nil {
err = errors.Wrap(db.handleError(err), "failed to exec insert event sql")
Copy link
Contributor

Choose a reason for hiding this comment

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

insert?

Comment on lines 232 to 239
expiredTriggered := false
query.RegisterExpiredEventsProcessor(func(ctx context.Context, events ...*model.Event) error {
expiredTriggered = true
return storage.DeleteExpiredFiles(ctx, events...)
})
log.Print("Wait for expiration trigger...")
time.Sleep(65 * time.Second)
require.True(t, expiredTriggered)
Copy link
Contributor

Choose a reason for hiding this comment

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

	ch := make(chan struct{}, 1)
	query.RegisterExpiredEventsProcessor(func(ctx context.Context, events ...*model.Event) error {
		ch <- struct{}{}
		return storage.DeleteExpiredFiles(ctx, events...)
	})
	log.Print("Wait for expiration trigger...")
	select {
		case <-ch:
		case <- time.After(65 * time.Second):
			t.Fatal("Expired events processor was not triggered")
	}

I would use smth like that. As a side note, 65 seconds ?

@ice-cronus ice-cronus dismissed stale reviews from ice-myles and ice-ares via 2f392ed December 20, 2024 14:28
@ice-cronus ice-cronus force-pushed the bugfix/storage_expiration branch from b0d1c54 to 3c4e721 Compare December 20, 2024 14:40
@ice-ares ice-ares merged commit c0b2f4f into master Dec 20, 2024
12 checks passed
@ice-ares ice-ares deleted the bugfix/storage_expiration branch December 20, 2024 14:42
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.

4 participants