replace tick by timeout in go function