vipyrsec / dragonfly-mainframe

The mainframe for Dragonfly
https://docs.vipyrsec.com/dragonfly-mainframe/
MIT License
4 stars 2 forks source link

Make getting jobs and setting them to pending atomic #220

Closed jonathan-d-zhang closed 3 months ago

jonathan-d-zhang commented 3 months ago

Currently, when we get jobs, we make 2 queries to fetch records, then update their status in the database. We aren't doing this atomically, which is :-1:.

We should use a CTE to update and return the rows we updated.