1. consolidate timer code
2. set timer before http request to avoid racing condition