简体   繁体   中英

time.sleep() alternative in continuous deployment

I have a piece of code

def work(param):
    time.sleep(600)
    #rest of code goes here

Now issue is the piece of code is going to run against multiple test cases before it is deployed and sleeping for 10mins or 600 seconds is crucial to work for implementing retry mechanism.

Let's say new developer comes to team and push a PR, I don't want his work to take 10 mins for a notification that build is passed or not.

def work(param,do_sleep = True):
    if do_sleep:time.sleep(600)
    #code goes brrrrrrr

With this modification when running test cases do_sleep can be set to False, meaning the 10min sleep wont trigger.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM