str_to_int becomes static
Don't sleep after MAX_REPEAT_QUERY tries