Configurable timeout

This includes a json schema change and a database schema change (both break stuff)... I also found what appeared to be a bug in how retries where decremented beyond 0.