Improve load of payments into DB

This commit is contained in:
Rene Vergara 2023-05-02 14:40:26 -05:00
parent c74b75d025
commit f8b69a1c87
Signed by: pitmutt
GPG key ID: 65122AD495A7F5B2

View file

@ -523,9 +523,16 @@ upsertPayment pipe dbName p = do
(memo p) (memo p)
let payment = val payTx let payment = val payTx
case payment of case payment of
Doc d -> Doc d -> do
access pipe master dbName $ results <-
upsert (select ["txid" =: txid p] "payments") d access
pipe
master
dbName
(rest =<< find (select ["txid" =: txid p] "payments"))
when (null results) $
access pipe master dbName $
upsert (select ["txid" =: txid p] "payments") d
_ -> return () _ -> return ()
authSettings :: AuthSettings authSettings :: AuthSettings