lib/litequeue/statements.sql.yml in litequeue-0.2.0 vs lib/litequeue/statements.sql.yml in litequeue-0.2.1
- old
+ new
@@ -1,26 +1,26 @@
push: >
INSERT INTO queue(id, name, fire_at, value)
- VALUES (HEX(RANDOMBLOB(32)), $1, (UNIXEPOCH('subsec') + $2), $3)
+ VALUES (HEX(RANDOMBLOB(32)), $1, (IFNULL(UNIXEPOCH('subsec'), UNIXEPOCH()) + $2), $3)
RETURNING id, name;
pop: >
DELETE FROM queue
WHERE name != '_dead'
AND (name, fire_at, id)
IN (
SELECT name, fire_at, id FROM queue
WHERE name = IFNULL($1, 'default')
- AND fire_at <= (UNIXEPOCH('subsec'))
+ AND fire_at <= IFNULL(UNIXEPOCH('subsec'), UNIXEPOCH())
ORDER BY fire_at ASC
LIMIT IFNULL($2, 1)
)
RETURNING id, value;
repush: >
INSERT INTO queue(id, name, fire_at, value)
- VALUES ($1, $2, (UNIXEPOCH('subsec') + $3), $4)
+ VALUES ($1, $2, (IFNULL(UNIXEPOCH('subsec'), UNIXEPOCH()) + $3), $4)
RETURNING name;
delete: >
DELETE FROM queue
WHERE id = $1
@@ -38,11 +38,11 @@
info: >
SELECT
name,
COUNT(*) AS count,
- AVG(UNIXEPOCH('subsec') - created_at) AS avg,
- MIN(UNIXEPOCH('subsec') - created_at) AS min,
- MAX(UNIXEPOCH('subsec') - created_at) AS max
+ AVG(IFNULL(UNIXEPOCH('subsec'), UNIXEPOCH()) - created_at) AS avg,
+ MIN(IFNULL(UNIXEPOCH('subsec'), UNIXEPOCH()) - created_at) AS min,
+ MAX(IFNULL(UNIXEPOCH('subsec'), UNIXEPOCH()) - created_at) AS max
FROM queue
GROUP BY name
ORDER BY count DESC;