gen_periodic call with timeout