feat: make amount of items sent on email configurable via occ#2673
Open
cristianscheid wants to merge 1 commit into
Open
feat: make amount of items sent on email configurable via occ#2673cristianscheid wants to merge 1 commit into
cristianscheid wants to merge 1 commit into
Conversation
4 tasks
Member
Author
|
Please note that psalm CI error is unrelated. |
miaulalala
previously requested changes
Jun 22, 2026
Collaborator
|
Can you please add some tests? |
e206438 to
27d5fe4
Compare
Signed-off-by: Cristian Scheid <cristianscheid@gmail.com>
27d5fe4 to
c5a7934
Compare
Collaborator
|
Did you test the performance when having that many items? |
Member
Author
I tested with the following env (nextcloud/nextcloud-docker-dev):
for i in $(seq 1 30); do
OC_PASS=admin docker exec -e OC_PASS=admin master-nextcloud-1 occ user:add --password-from-env --email user$i@mail.com user$i
done
docker exec master-nextcloud-1 occ config:app:set activity mail_max_items --value=1000
-- 1 user
SET @now = UNIX_TIMESTAMP();
INSERT INTO `oc_activity_mq` (`amq_timestamp`, `amq_latest_send`, `amq_type`, `amq_affecteduser`, `amq_appid`, `amq_subject`, `amq_subjectparams`, `object_type`, `object_id`)
SELECT @now, @now, 'shared', u.user, 'files_sharing', 'shared_with_by', '[{"462":"\/mock.json"},"admin"]', 'files', 462
FROM (SELECT 1 FROM information_schema.columns LIMIT 1005) t
CROSS JOIN (SELECT 'user1' AS user) u;
-- 10 users
SET @now = UNIX_TIMESTAMP();
INSERT INTO `oc_activity_mq` (`amq_timestamp`, `amq_latest_send`, `amq_type`, `amq_affecteduser`, `amq_appid`, `amq_subject`, `amq_subjectparams`, `object_type`, `object_id`)
SELECT @now, @now, 'shared', u.user, 'files_sharing', 'shared_with_by', '[{"462":"\/mock.json"},"admin"]', 'files', 462
FROM (SELECT 1 FROM information_schema.columns LIMIT 1005) t
CROSS JOIN (SELECT 'user1' AS user UNION ALL SELECT 'user2' UNION ALL SELECT 'user3' UNION ALL SELECT 'user4' UNION ALL SELECT 'user5' UNION ALL SELECT 'user6' UNION ALL SELECT 'user7' UNION ALL SELECT 'user8' UNION ALL SELECT 'user9' UNION ALL SELECT 'user10') u;
-- 20 users
SET @now = UNIX_TIMESTAMP();
INSERT INTO `oc_activity_mq` (`amq_timestamp`, `amq_latest_send`, `amq_type`, `amq_affecteduser`, `amq_appid`, `amq_subject`, `amq_subjectparams`, `object_type`, `object_id`)
SELECT @now, @now, 'shared', u.user, 'files_sharing', 'shared_with_by', '[{"462":"\/mock.json"},"admin"]', 'files', 462
FROM (SELECT 1 FROM information_schema.columns LIMIT 1005) t
CROSS JOIN (SELECT 'user1' AS user UNION ALL SELECT 'user2' UNION ALL SELECT 'user3' UNION ALL SELECT 'user4' UNION ALL SELECT 'user5' UNION ALL SELECT 'user6' UNION ALL SELECT 'user7' UNION ALL SELECT 'user8' UNION ALL SELECT 'user9' UNION ALL SELECT 'user10' UNION ALL SELECT 'user11' UNION ALL SELECT 'user12' UNION ALL SELECT 'user13' UNION ALL SELECT 'user14' UNION ALL SELECT 'user15' UNION ALL SELECT 'user16' UNION ALL SELECT 'user17' UNION ALL SELECT 'user18' UNION ALL SELECT 'user19' UNION ALL SELECT 'user20') u;
-- 30 users
SET @now = UNIX_TIMESTAMP();
INSERT INTO `oc_activity_mq` (`amq_timestamp`, `amq_latest_send`, `amq_type`, `amq_affecteduser`, `amq_appid`, `amq_subject`, `amq_subjectparams`, `object_type`, `object_id`)
SELECT @now, @now, 'shared', u.user, 'files_sharing', 'shared_with_by', '[{"462":"\/mock.json"},"admin"]', 'files', 462
FROM (SELECT 1 FROM information_schema.columns LIMIT 1005) t
CROSS JOIN (SELECT 'user1' AS user UNION ALL SELECT 'user2' UNION ALL SELECT 'user3' UNION ALL SELECT 'user4' UNION ALL SELECT 'user5' UNION ALL SELECT 'user6' UNION ALL SELECT 'user7' UNION ALL SELECT 'user8' UNION ALL SELECT 'user9' UNION ALL SELECT 'user10' UNION ALL SELECT 'user11' UNION ALL SELECT 'user12' UNION ALL SELECT 'user13' UNION ALL SELECT 'user14' UNION ALL SELECT 'user15' UNION ALL SELECT 'user16' UNION ALL SELECT 'user17' UNION ALL SELECT 'user18' UNION ALL SELECT 'user19' UNION ALL SELECT 'user20' UNION ALL SELECT 'user21' UNION ALL SELECT 'user22' UNION ALL SELECT 'user23' UNION ALL SELECT 'user24' UNION ALL SELECT 'user25' UNION ALL SELECT 'user26' UNION ALL SELECT 'user27' UNION ALL SELECT 'user28' UNION ALL SELECT 'user29' UNION ALL SELECT 'user30') u;
docker exec master-nextcloud-1 occ background-job:list | grep EmailNotification
time docker exec master-nextcloud-1 occ background-job:execute <job-id>
@miaulalala not sure if this is the kind of testing you had in mind. If you think a different approach would be more appropriate, feel free to let me know. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
Context
OCA\Activity\BackgroundJob\EmailNotificationbackground jobMailQueueHandler::sendEmails()MailQueueHandler::ENTRY_LIMITdefines how many activities are fully shown in the email body, anything beyond that is truncated, as shown below:Changes introduced by this PR
MailQueueHandler::MAIL_MAX_ITEMS_CAPas a safeguard against excessively large valuesTODO
Checklist
3. to review, feature component)stable32)AI (if applicable)