Created
May 22, 2015 00:21
-
-
Save elhoyos/a3a75969ec01370e6ae3 to your computer and use it in GitHub Desktop.
Update specific number of jobs and return their ids
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- In psql | |
UPDATE jobs | |
SET isRunning = true | |
WHERE | |
id IN ( | |
SELECT id | |
FROM jobs | |
WHERE | |
providerid = "foo" AND | |
callback = "crawlBar" AND | |
isrunning = FALSE AND | |
nextrun <= 1432252565689 | |
LIMIT 50 | |
) | |
RETURNING id; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment