Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
haskell-pgmq
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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-pgmq
Commits
b45423de
Verified
Commit
b45423de
authored
Oct 23, 2024
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
queueAvailableIds function
parent
0591a643
Pipeline
#6884
passed with stages
in 6 minutes and 42 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
1 deletion
+10
-1
Simple.hs
src/Database/PGMQ/Simple.hs
+10
-1
No files found.
src/Database/PGMQ/Simple.hs
View file @
b45423de
...
...
@@ -33,7 +33,8 @@ module Database.PGMQ.Simple
,
sendMessage
,
sendMessages
,
setMessageVt
,
queueAvailableLength
)
,
queueAvailableLength
,
queueAvailableIds
)
where
...
...
@@ -279,6 +280,14 @@ queueAvailableLength conn queue = do
[
PSQL
.
Only
len
]
<-
PSQL
.
query
conn
[
sql
|
SELECT COUNT(*) FROM ? WHERE vt <= now()
|]
(
PSQL
.
Only
tableId
)
::
IO
[
PSQL
.
Only
Int
]
return
len
-- | Same as 'queryAvailableLength' but returns the ids of messages.
queueAvailableIds
::
PSQL
.
Connection
->
Queue
->
IO
[
MessageId
]
queueAvailableIds
conn
queue
=
do
let
queueTable
=
"q_"
<>
queue
let
tableId
=
PSQL
.
QualifiedIdentifier
(
Just
"pgmq"
)
$
T
.
pack
queueTable
ret
<-
PSQL
.
query
conn
[
sql
|
SELECT msg_id FROM ? WHERE vt <= now()
|]
(
PSQL
.
Only
tableId
)
::
IO
[
PSQL
.
Only
MessageId
]
return
$
(
\
(
PSQL
.
Only
msgId
)
->
msgId
)
<$>
ret
{-|
A utility function: sometimes pgmq throws an error that a table (for
...
...
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