I have a telegram bot which is designed for solve quizes and there's one function that checks timeout or not... but since bot users are about 90k the logic that I wrote it being useless... what I did is:
gets all users who's currently solving tests
checks if time is out or not
now the problamatic part
does foreach for every user who's solving test right now and sends new test but in this time it also must update the [test time, current_index]. and also, if there's no more tests it should end the test which means there's if statement also. I tried to but them to jobs but didn't work.
One of the problems here the whole timeUp check query is taking approximately 30000ms - 50000ms (30-50s) but it should check if there's tests which time is up.
I really do not know what to do and how to do... I make indexing for these tables it helped but still not that fast...