Commit graph

442 commits

Author SHA1 Message Date
Pierre de La Morinerie
d0e87a08cf services: cache zxcvbn dictionaries per-thread
Before, every time a password was tested, the dictionaries were parsed
again by zxcvbn.

Parsing dictionaries is slow: it may take up to ~1s. This doesn't matter
that much in production, but it makes tests very slow (because we tend
to create a lot of User records).

With this changes, the initializer tester is shared between calls, class
instances and threads. It is lazily loaded on first use, in order not to
slow down the application boot sequence.

This uses ~20 Mo of memory (only once for all threads), but makes tests
more that twice faster.

For instance, model tests go from **8m 21s** to **3m 26s**.

NB:
An additionnal optimization could be to preload the tester on
boot, before workers are forked, to take advantage of Puma copy-on-write
mechanism. In this way all forked workers would use the same cached
instance.

But:

- We're not actually sure this would work properly. What if Ruby updates
  an interval ivar on the class, and this forces the OS to copy the
  whole data structure in each fork?
- Puma phased restarts are not compatible with copy-on-write anyway.

So we're avoiding this optimisation for now, and take the extra 20 Mo
per worker.
2021-10-25 12:04:56 +02:00
Paul Chavard
1ca8192864 perf(export): load dossiers.champs in batches 2021-10-20 16:52:38 +02:00
kara Diaby
0bd879ec9b modify pj service 2021-10-05 15:00:21 +02:00
Paul Chavard
44eb0ada4f fix(i18n): add Kosovo to countries list
Kosovo is not part of ISO 3166 as of time of writing. https://en.wikipedia.org/wiki/ISO_3166-2:RS#cite_ref-1
2021-09-08 12:11:25 +02:00
Paul Chavard
96cbbc0192 fix(virus scan): prevent virus scan on archives and signatures uploads 2021-09-07 14:21:48 +02:00
Paul Chavard
084e48c8e3 fix(dossier_projection_service): select external_id on champs 2021-09-07 14:07:55 +02:00
Christophe Robillard
031b74759f archives: move bugreport 2021-08-05 09:24:20 +02:00
Christophe Robillard
38e3469e9a add bug report to archive 2021-08-03 14:51:41 +02:00
François Vantomme
17b659539f Feat (API Particulier): new encryption service 2021-07-30 11:18:44 +02:00
Christophe Robillard
67c0d93eae Debugging archive generation
debugging exception that occurs sometime when trying to download pj during
archive generation
2021-07-29 11:12:07 +02:00
Paul Chavard
ce27999bc3 Refactor clone_attachments 2021-07-01 16:21:46 +02:00
Christophe Robillard
cd36f2622f fix download FakeAttachment 2021-06-24 21:02:55 +02:00
Christophe Robillard
66cc0dd08d Revert "Revert "Expose dossier PDF export as IO""
This reverts commit 362093eff0.
2021-06-24 21:01:59 +02:00
krichtof
362093eff0
Revert "Expose dossier PDF export as IO" 2021-06-24 19:21:37 +02:00
Paul Chavard
f39944a02e Create procedure sub folder in archives
Co-authored-by: Christophe Robillard <christophe.robillard@beta.gouv.fr>
2021-06-24 17:50:17 +02:00
Paul Chavard
b73d504f8d Expose dossier PDF export as IO
Co-authored-by: Christophe Robillard <christophe.robillard@beta.gouv.fr>
2021-06-24 17:49:24 +02:00
Paul Chavard
19195008e8 Expose removed types_de_champ in exports 2021-06-23 09:40:07 +02:00
kara Diaby
87ce71f27d fix import service 2021-06-21 14:11:05 +02:00
Christophe Robillard
fdec9b2fd5 archives: don't update dossiers
this fix avoid to touch dossier after attaching pdf_export_for_instructeur
2021-06-18 11:00:57 +02:00
kara Diaby
6353104ecb modify service 2021-06-15 19:36:46 +02:00
François Vantomme
c9b1095d1e Refactor (Rubocop): replace map{ … }.compact by filter_map
In Ruby 2.7, Enumerable#filter_map has been added.
This cop identifies places where map { … }.compact can be replaced by filter_map.

See: https://docs.rubocop.org/rubocop-performance/cops_performance.html#performancemapcompact
2021-06-11 15:38:09 +02:00
Paul Chavard
990ae10399 GraphQL byte_size should be BigInt 2021-06-03 10:53:17 +02:00
Paul Chavard
18ce027b84 Update dossier serialize query to stop using deprecated fileds 2021-05-26 11:12:06 +02:00
Paul Chavard
01c558953b Remove API GEO legacy adapter 2021-05-24 11:50:16 +02:00
simon lehericey
63311eceb0 avoid serializing long id list in case of huge procedure, search on it before 2021-05-20 12:08:04 +02:00
simon lehericey
17617fba43 address champ needs the data column 2021-05-19 15:59:18 +02:00
simon lehericey
a46000dc1f ensure to_s is used on specialized champ 2021-05-19 09:39:20 +02:00
Paul Chavard
e043645a88 cleanup tests 2021-05-18 11:42:10 +02:00
kara Diaby
fdde55f675 modify service 2021-05-18 11:42:10 +02:00
simon lehericey
9fd1c604a1 display follower instructeur emails in alphabetic order 2021-05-04 16:38:34 +02:00
Christophe Robillard
01f180022b prend en compte uniquement les pj pour estimer la taille d'un dossier 2021-05-04 12:50:12 +02:00
Christophe Robillard
3d04221dab generate pdf export for dossier only on demand 2021-04-29 17:30:38 +02:00
Christophe Robillard
f40d96fbd2 Revert "Revert "Export de tous les dossier d'une démarche""
This reverts commit d9a588b52e.
2021-04-29 17:29:47 +02:00
krichtof
d9a588b52e
Revert "Export de tous les dossier d'une démarche" 2021-04-29 16:07:18 +02:00
simon lehericey
7b94c2de88 remove extra Dossier call in projection 2021-04-29 11:46:00 +02:00
simon lehericey
5cfb4114ce one query per table 2021-04-29 11:23:41 +02:00
Christophe Robillard
09870c918d prevent race conditions when creating archives 2021-04-28 11:40:58 +02:00
Christophe Robillard
dfbe004122 rename content_type to time_span_type for archives 2021-04-28 11:40:58 +02:00
Christophe Robillard
9134114c2e fix rubocop offenses 2021-04-28 11:40:58 +02:00
Christophe Robillard
8bee53fe77 rend plus robuste la création de l'archive 2021-04-28 11:40:58 +02:00
Christophe Robillard
07cc4fa97f add service to create procedure archive 2021-04-28 11:40:58 +02:00
Christophe Robillard
fba0d78153 generate pdf export inside pieces_justificatives_service 2021-04-28 11:40:58 +02:00
Paul Chavard
c20ad5ca17 Remove the link between commentaire and user 2021-04-22 15:10:47 +01:00
simon lehericey
5bfd4ecbbf add DossierProjectionService 2021-04-22 10:46:04 +02:00
Pierre de La Morinerie
185c74d891 dossier: fix SQL deprecation error
ActiveRecord 6.1 disallows passing strings to the `order()` function, to
prevent SQL injections.

Here we know that the order string is safe: `ts_vector` is constant,
and `ts_query` is properly escaped.

Wrap the SQL fragment in Arel.sql to bypass the error.
2021-03-25 13:24:53 +01:00
kara Diaby
fff6725799 modify api and serializer 2021-03-24 17:47:24 +01:00
kara Diaby
2930de1015 remove useless code in models 2021-03-24 17:47:24 +01:00
Paul Chavard
9c3e72c84a Use revision instead of groupe instructeur as dossier procedure link 2021-03-09 14:47:23 +01:00
Paul Chavard
96a832bc19 Add SerializerService 2021-03-02 12:42:22 +01:00
Pierre de La Morinerie
98be7e2076 Fix new Rubocop warnings 2021-02-16 16:31:30 +00:00