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(server): wait five minutes before sending email on new album item #12223

Merged

Conversation

HeyBanditoz
Copy link
Contributor

@HeyBanditoz HeyBanditoz commented Sep 1, 2024

Album update jobs will now wait five minutes to send. If a new image is added while that job is pending, the old job will be cancelled, and a new one will be enqueued for a minute.

This is to prevent a flood of notifications by dragging in images directly to the album, which adds them to the album one at a time.

Album updates now include a list of users to email, which is generally everybody except the updater. If somebody else updates the album within that minute, both people will get an album update email in a minute, as they both added images and the other should be notified.

@bo0tzz bo0tzz linked an issue Sep 7, 2024 that may be closed by this pull request
3 tasks
@HeyBanditoz HeyBanditoz force-pushed the feat/no-spammy-email-notifs branch 2 times, most recently from 6a50955 to d79fb91 Compare September 7, 2024 22:22
@HeyBanditoz HeyBanditoz changed the title feat(server): notifs for album update are delayed and replaced on dupe, copying the original recipients to the new notif feat(server): wait 60 seconds before sending email on new album item Sep 7, 2024
@alextran1502
Copy link
Contributor

@mertalev @jrasm91 anything you guys would like to address in this PR?

@mertalev
Copy link
Contributor

mertalev commented Oct 9, 2024

We talked about different approaches for notifications, but came to the conclusion that this approach is fine for now until we have a more detailed plan on how notifications should be scheduled.

@HeyBanditoz
Copy link
Contributor Author

@mertalev @alextran1502 I've resolved conflicts, this should be ready for review now

@mblissmer
Copy link

Just a thought: i'd love to see this either configurable (which would be a lot more work I assume), or have 60 seconds bumped up to something way higher, like 15 minutes or something. Like, why not?

@simono41
Copy link

Just a thought: i'd love to see this either configurable (which would be a lot more work I assume), or have 60 seconds bumped up to something way higher, like 15 minutes or something. Like, why not?

Let's get this pull request through first. I just went on vacation with some friends and they always complain when someone uploads one or more pictures. I had to temporarily completely deactivate the email notification function until further notice so that your inbox wouldn't be flooded.

@HeyBanditoz
Copy link
Contributor Author

Yeah I picked 60 seconds since it takes a quarter of that time to upload an image one-by-one to my VPS running Immich.

If I recall correctly. a workaround to prevent the notification flood is to upload all the images to your user, then navigate to the album and bulk add them there (plus at top right on web) so they aren't added one-by-one.

server/src/services/notification.service.ts Outdated Show resolved Hide resolved
server/src/repositories/job.repository.ts Outdated Show resolved Hide resolved
server/src/services/notification.service.ts Outdated Show resolved Hide resolved
server/src/services/notification.service.ts Outdated Show resolved Hide resolved
server/src/repositories/job.repository.ts Outdated Show resolved Hide resolved
server/src/services/notification.service.ts Outdated Show resolved Hide resolved
@mertalev
Copy link
Contributor

I think 60s is a little too short considering videos and slower connections. 300s would be nicer imo

@HeyBanditoz HeyBanditoz changed the title feat(server): wait 60 seconds before sending email on new album item feat(server): wait five minutes before sending email on new album item Oct 16, 2024
server/src/services/album.service.ts Outdated Show resolved Hide resolved
server/src/repositories/job.repository.ts Outdated Show resolved Hide resolved
@HeyBanditoz HeyBanditoz force-pushed the feat/no-spammy-email-notifs branch 2 times, most recently from 9c4293e to 0207ab3 Compare October 16, 2024 18:27
server/src/repositories/job.repository.ts Outdated Show resolved Hide resolved
server/src/repositories/job.repository.ts Outdated Show resolved Hide resolved
server/src/repositories/job.repository.ts Outdated Show resolved Hide resolved
server/src/services/album.service.ts Outdated Show resolved Hide resolved
server/src/services/notification.service.spec.ts Outdated Show resolved Hide resolved
@HeyBanditoz HeyBanditoz force-pushed the feat/no-spammy-email-notifs branch 3 times, most recently from fcaab70 to f7391b9 Compare October 16, 2024 21:37
Album update jobs will now wait five minutes to send. If a new image is added while that job is pending, the old job will be cancelled, and a new one will be enqueued for a minute.

This is to prevent a flood of notifications by dragging in images directly to the album, which adds them to the album one at a time.

Album updates now include a list of users to email, which is generally everybody except the updater. If somebody else updates the album within that minute, both people will get an album update email in a minute, as they both added images and the other should be notified.
@alextran1502 alextran1502 merged commit 4a2a7b7 into immich-app:main Oct 18, 2024
33 checks passed
yosit pushed a commit to yosit/immich that referenced this pull request Oct 24, 2024
immich-app#12223)

Album update jobs will now wait five minutes to send. If a new image is added while that job is pending, the old job will be cancelled, and a new one will be enqueued for a minute.

This is to prevent a flood of notifications by dragging in images directly to the album, which adds them to the album one at a time.

Album updates now include a list of users to email, which is generally everybody except the updater. If somebody else updates the album within that minute, both people will get an album update email in a minute, as they both added images and the other should be notified.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Immich sends email per newly added asset to an album.
6 participants