dynamically adjust main loop sleep time according to recommended value