Skip to content

Commit

Permalink
OY-5025 Parannettu lokitusta
Browse files Browse the repository at this point in the history
  • Loading branch information
jkorri committed Jan 2, 2025
1 parent b5addf4 commit c55810b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/liiteri/preview/preview_generator.clj
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,14 @@
(log/info (format "Generating previews for '%s' with key '%s', uploaded on %s ..." filename file-key uploaded))
(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] (.invokeAny timeout-scheduler [#(interface/generate-previews-for-file storage-engine
[page-count previews] (.invokeAny timeout-scheduler [#(try
(interface/generate-previews-for-file storage-engine
file
input-stream
config)] preview-timeout-ms TimeUnit/MILLISECONDS)]
config)
(catch Throwable t
(log/error t "Error in generating previews task")
(throw t)))] preview-timeout-ms TimeUnit/MILLISECONDS)]
(doseq [[page-index preview-as-byte-array] (map-indexed vector previews)]
(let [preview-key (str file-key "." page-index)
preview-filename preview-key]
Expand Down Expand Up @@ -90,7 +94,7 @@
(when (generate-next-preview config db storage-engine timeout-scheduler)
(recur)))
(catch Throwable t
(println "Unexpected throwable!")
(log/error t "Unexpected throwable!")
(.printStackTrace t))))

(defprotocol Generator
Expand Down
1 change: 1 addition & 0 deletions src/liiteri/virus_scan.clj
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
(log/info "Starting virus scan results polling")
(a/go-loop []
(when-let [_ (a/<! times)]
(log/info "Polling for virus scan results")
(while (< 0 (poll-scan-results sqs-poll-results-client result-queue-url db storage-engine config)))
(recur)))
(assoc this :chan times
Expand Down

0 comments on commit c55810b

Please sign in to comment.