diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2016-01-31 14:14:07 +0000 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2016-01-31 14:14:07 +0000 |
commit | 25234d9fc9f281805ab9ab9d44338962213fb23e (patch) | |
tree | b633ddb1249af79b3c6df74cf6182d30e7d5b4a0 | |
parent | 9dd562eef0c4ff6f15e6ef3e7c360f5fdf04573b (diff) | |
download | thermoprint-25234d9fc9f281805ab9ab9d44338962213fb23e.tar thermoprint-25234d9fc9f281805ab9ab9d44338962213fb23e.tar.gz thermoprint-25234d9fc9f281805ab9ab9d44338962213fb23e.tar.bz2 thermoprint-25234d9fc9f281805ab9ab9d44338962213fb23e.tar.xz thermoprint-25234d9fc9f281805ab9ab9d44338962213fb23e.zip |
Removed danger of crash due to corner case
-rw-r--r-- | server/src/Thermoprint/Server/Printer.hs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/server/src/Thermoprint/Server/Printer.hs b/server/src/Thermoprint/Server/Printer.hs index 55bfabc..67180c4 100644 --- a/server/src/Thermoprint/Server/Printer.hs +++ b/server/src/Thermoprint/Server/Printer.hs | |||
@@ -89,7 +89,9 @@ runPrinter Printer{..} = forever $ do | |||
89 | return jobId | 89 | return jobId |
90 | job <- runSqlPool (get jobId) =<< ask | 90 | job <- runSqlPool (get jobId) =<< ask |
91 | case job of | 91 | case job of |
92 | Nothing -> $(logWarn) "Nonexistent job id in printer queue" | 92 | Nothing -> do |
93 | atomically' $ modifyTVar' queue (\Queue{..} -> force $ Queue pending Nothing history) | ||
94 | $(logWarn) "Nonexistent job id in printer queue" | ||
93 | Just job -> do | 95 | Just job -> do |
94 | $(logInfo) . T.pack $ "Printing " ++ show (unSqlBackendKey . unJobKey $ jobId) | 96 | $(logInfo) . T.pack $ "Printing " ++ show (unSqlBackendKey . unJobKey $ jobId) |
95 | printReturn <- (unPM print) (jobContent job) -- We could, at this point, do some exception handling. It was decided that this would be undesirable, because we really don't have any idea what exceptions to catch | 97 | printReturn <- (unPM print) (jobContent job) -- We could, at this point, do some exception handling. It was decided that this would be undesirable, because we really don't have any idea what exceptions to catch |