Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
haskell-bee
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
haskell-bee
Commits
da1a7aaa
Verified
Commit
da1a7aaa
authored
Aug 21, 2024
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[redis] key -> sequence
parent
9c8987f5
Pipeline
#6514
failed with stages
in 14 minutes and 16 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
10 deletions
+11
-10
Redis.hs
src/Async/Worker/Broker/Redis.hs
+11
-10
No files found.
src/Async/Worker/Broker/Redis.hs
View file @
da1a7aaa
...
...
@@ -190,7 +190,7 @@ beePrefix = "bee-"
-- | Redis counter that returns message ids
idKey
::
Queue
->
BS
.
ByteString
idKey
queue
=
BS
.
pack
$
beePrefix
<>
"
key
-"
<>
queue
idKey
queue
=
BS
.
pack
$
beePrefix
<>
"
sequence
-"
<>
queue
nextId
::
Broker
RedisBroker
a
->
Queue
->
IO
(
Maybe
Int
)
nextId
(
RedisBroker'
{
conn
})
queue
=
do
...
...
@@ -204,6 +204,15 @@ nextId (RedisBroker' { conn }) queue = do
messageKey
::
Queue
->
MessageId
RedisBroker
->
BS
.
ByteString
messageKey
queue
(
RedisMid
msgId
)
=
queueKey
queue
<>
BS
.
pack
(
"-message-"
<>
show
msgId
)
-- | Key for storing the set of message ids in queue
queueKey
::
Queue
->
BS
.
ByteString
queueKey
queue
=
BS
.
pack
$
beePrefix
<>
"queue-"
<>
queue
-- | Key for storing the set of message ids in archive
archiveKey
::
Queue
->
BS
.
ByteString
archiveKey
queue
=
BS
.
pack
$
beePrefix
<>
"archive-"
<>
queue
getRedisMessage
::
FromJSON
a
=>
Broker
RedisBroker
a
->
Queue
...
...
@@ -219,15 +228,6 @@ getRedisMessage (RedisBroker' { conn }) queue msgId = do
case
Aeson
.
decode
(
BSL
.
fromStrict
msg
)
of
Just
dmsg
->
return
$
Just
$
RedisBM
dmsg
Nothing
->
return
Nothing
-- | Key for storing the set of message ids in queue
queueKey
::
Queue
->
BS
.
ByteString
queueKey
queue
=
BS
.
pack
$
beePrefix
<>
"queue-"
<>
queue
-- | Key for storing the set of message ids in archive
archiveKey
::
Queue
->
BS
.
ByteString
archiveKey
queue
=
BS
.
pack
$
beePrefix
<>
"archive-"
<>
queue
-- | Helper datatype to store message with a unique id.
-- We fetch the id by using 'INCR'
...
...
@@ -246,3 +246,4 @@ instance ToJSON a => ToJSON (RedisWithMsgId a) where
"rmida"
.=
rmida
,
"rmidId"
.=
rmidId
]
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment