frontend: hot-fix pending-jobs route again
The route was made too slow again by ddb706f92838dd16, and we did not
notice the fact until now (when there's 6k+ pending tasks).
Since the backend had troubles to fill the build queue due to this bug
(_most_ of the time we got 504 error) this was breaking other stuff like
VM allocation mechanism (VMs were not re-used, because getting new tasks
took too long to fit the reuse_opportunity_time resalloc limit), etc.
The trick here in the fix is to move the code throwing another SQL query
(for each task in the queue!) behind the 'if short' condition. For the
purpose of build scheduling the additional info isn't needed (that's the
purpose of short argument anyway).
Fixes: #1409
Merges: #1410