Skip to content

Commit

Permalink
OY-5023 Estetään tilanne jossa JVM:än kaatuminen preview-generoinniss…
Browse files Browse the repository at this point in the history
…a aiheuttaa kaatumisloopin

  Aikaisemmin tiedoston preview-generoinnin tilaa muutettiin vasta kun generointia oli yritetty.
  Tästä seurasi että mikäli generointi kaatoi JVM:än sitä yritettiin aina uudestaan samoin
  tuloksin. Nyt lisätty generointiin uusi tila started jolloin sitä ei käynnistetä enää uudestaan.
  • Loading branch information
jkorri committed Dec 18, 2024
1 parent a5c5ab4 commit 9c17275
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TYPE preview_generation_status ADD VALUE 'started' AFTER 'not_generated';
3 changes: 3 additions & 0 deletions src/liiteri/preview/preview_generator.clj
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@
uploaded :uploaded} file]
(try
(log/info (format "Generating previews for '%s' with key '%s', uploaded on %s ..." filename file-key uploaded))
; Tämä on varotoimenpide tapauksille joissa generointi kaataa JVM:än. Ilman tilan päivitystä generointia yritään
; aina uudestaan samoin (huonoin) tuloksin koska tiedosto on edelleen not started -tilassa.
(metadata-store/set-file-page-count-and-preview-status! file-key nil "started" conn)
(with-open [input-stream (file-store/get-file storage-engine file-key)]
(let [preview-timeout-ms (get-in config [:preview-generator :preview-timeout-ms] 45000)
[page-count previews] (with-timeout #(interface/generate-previews-for-file storage-engine
Expand Down
2 changes: 1 addition & 1 deletion src/liiteri/schema.clj
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
:final s/Bool
:uploaded DateTime
:deleted (s/maybe DateTime)
:preview-status (s/enum "not_supported" "not_generated" "finished" "error")
:preview-status (s/enum "not_supported" "not_generated" "started" "finished" "error")
:previews [Preview]
(s/optional-key :content-disposition) (s/maybe s/Str)})

0 comments on commit 9c17275

Please sign in to comment.