Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

backend:kv-delete-query-fix #36

Merged
merged 1 commit into from
Dec 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions src/EulerHS/KVConnector/Flow.hs
Original file line number Diff line number Diff line change
Expand Up @@ -637,17 +637,15 @@ updateKVAndDBResults meshCfg whereClause eitherDbRows eitherKvRows mbUpdateVals
kvDeadRows = snd allKVRows
kvLiveAndDeadRows = kvLiveRows ++ kvDeadRows
matchedKVLiveRows = findAllMatching whereClause kvLiveRows
if isRecachingEnabled && meshCfg.meshEnabled
if isRecachingEnabled && meshCfg.meshEnabled && isLive
then do
let uniqueDbRows = getUniqueDBRes meshCfg.redisKeyPrefix allDBRows kvLiveAndDeadRows
reCacheDBRowsRes <- reCacheDBRows meshCfg uniqueDbRows
case reCacheDBRowsRes of
Left err -> return $ Left $ RedisError (show err <> "Primary key => " <> show (getLookupKeyByPKey meshCfg.redisKeyPrefix <$> uniqueDbRows) <> " Secondary key => " <> show (getSecondaryLookupKeys meshCfg.redisKeyPrefix <$> uniqueDbRows) <> " in updateKVAndDBResults")
Right _ -> do
let allRows = matchedKVLiveRows ++ uniqueDbRows
sequence <$> if isLive
then mapM (updateObjectRedis meshCfg updVals setClause True whereClause) allRows
else mapM (deleteObjectRedis meshCfg True whereClause) allRows
sequence <$> mapM (updateObjectRedis meshCfg updVals setClause True whereClause) allRows
else do
updateOrDelKVRowRes <- if isLive
then mapM (updateObjectRedis meshCfg updVals setClause True whereClause) matchedKVLiveRows
Expand Down