set timeout for giving resolve of the whole function