(self, window=SCAN_TTL)
Clear scan pools generated before time window,
        Clear all scan pools if window is -1.
Clear scan pools generated before time window,
        Clear all scan pools if window is -1.
Clear scan pools generated before time window Clear all scan pools if window is - 1 .
def clean_stale(self, window=SCAN_TTL):
        """
        Clear scan pools generated before time window,
        Clear all scan pools if window is -1.
        """
        try:
            now = time.time()
            clean_list = glob.glob('/tmp/kimchi-scan-*')
            for d in clean_list:
                transient_pool = os.path.basename(
                    d).replace('kimchi-scan-', '')[0:-6]
                if now - os.path.getmtime(d) > window:
                    shutil.rmtree(d)
                    self.clean_cb(transient_pool)
        except OSError as e:
            msg = f'Exception {e} occured when cleaning stale pool, ignore'
            wok_log.debug(msg)
def clean_stale ( self , window = SCAN_TTL ) : try : now = time . time ( ) clean_list = glob . glob ( '/tmp/kimchi-scan-*' ) for d in clean_list : transient_pool = os . path . basename ( d ) . replace ( 'kimchi-scan-' , '' ) [ 0 : - 6 ] if now - os . path . getmtime ( d ) > window : shutil . rmtree ( d ) self . clean_cb ( transient_pool ) except OSError as e : msg = f'Exception {e} occured when cleaning stale pool, ignore' wok_log . debug ( msg )