add timeout for recompile
put a mutex around recompiling