db: fix race test
db: copy the value of maxIdleTime to avoid data races

Bad, bad closure. No donuts for you.