Commit graph

18 commits

Author SHA1 Message Date
Pierre de La Morinerie
0e35bc609d notifications: don't preload dossiers on instructeurs
This request currently times out almost every night in production.

It's because although Instructeurs are loaded in batches (default batch
size is 1000), loading all dossiers for 1000 instructeurs is slow.

Turns out the code executed after this query to compute notifications
doesn't even use these dossiers. Indeed it is faster not to preload
them: both the initial query and the total treatment time are shorter.

Here's a quick benchmark made locally (but using production data):

- Before this commit:

	Benchmark.measure { pp Instructeur.includes(assign_to: { procedure: :dossiers }).where(assign_tos: { daily_email_notifications_enabled: true }).limit(100).m
ap(&:email_notification_data) }

Only the initial query : 35s
Total time : 97s

- Without preloading dossiers:

	Benchmark.measure { pp Instructeur.includes(assign_to: :procedure).where(assign_tos: { daily_email_notifications_enabled: true }).limit(100).m
ap(&:email_notification_data) }

Only the initial query : 0.08s (400x faster)
Total time : 29s (3,3x faster)

Plus it doesn't timeout, of course.
2021-12-09 12:10:00 +01:00
kara Diaby
4a70a7fcc8 remove email_notifications_enabled column because of the new daily_email_notifications_enabled 2020-02-27 11:09:19 +01:00
simon lehericey
3fde2a6f70 Rename gestionnaire in code to instructeur 2019-08-12 13:47:01 +02:00
simon lehericey
6607de4827 Notification: add service to send notifications 2019-03-18 16:37:51 +01:00
gregoirenovel
142241dd16 Remove notifications 2018-02-06 14:07:20 +01:00
gregoirenovel
278a662350 Enable the Layout/SpaceAroundEqualsInParameterDefault cop 2018-01-18 10:53:34 +01:00
gregoirenovel
3363e21427 Enable the Layout/IndentAssignment cop 2018-01-15 22:33:12 +01:00
gregoirenovel
24e7537c49 Enable the Layout/EmptyLinesAroundClassBody cop 2017-06-13 10:35:32 +02:00
gregoirenovel
1b78a8e957 Enable the Layout/CaseIndentation cop 2017-06-13 10:35:19 +02:00
Simon Lehericey
cdcd5b951f AvisController: add a notification when a avis has been received 2017-05-29 11:44:28 +02:00
gregoirenovel
ddf02ccd6d Use a non-breaking space after the “numéro” contraction 2017-04-19 11:19:53 +02:00
gregoirenovel
ba4ee68019 Use masculine ordinal indicator instead of the degree sign
It’s the right way to contract “numéro”

We should use the superscript lowercase o but
it’s hard to do in places where only raw text is
available
2017-04-19 11:19:53 +02:00
JC
42915979da Notifications are shown in backoffice dossier show, limit 5 2016-12-26 17:18:45 +01:00
Xavier J
33362d1a52 Add notification for submitted state 2016-12-26 11:57:08 +01:00
Xavier J
33c1a12b84 Add notification for champs 2016-12-26 11:47:51 +01:00
Xavier J
e5768b6798 Add notification for piece justificative 2016-12-26 11:42:02 +01:00
Xavier J
6ed91073c4 Add notification for cerfa 2016-12-26 11:33:12 +01:00
Xavier J
54fbe367c0 Add notifications when user post a comment 2016-12-22 20:40:23 +01:00