Just to aid communication, let us say there is an 'Allowed List' and a 'Currently Running' List
Are you looking up BOTH OF THOSE LISTS every 2 seconds ?

- - - - ALLOWED LIST
Why do you have to read that every 2 secs ?
Surely that list's contents does not change frequently ?

- - - CURRENTLY RUNNING LIST
Why is the list of processes that are currently running in the DB ?
Do you have some other program doing 'a scan' and it then lists them in the DB ?
Why not take the code that does the scan and put that in your program, so you do not need to look up the DB for that

Please provide longer more detailed answers.