def check_state(self): timestamp = self._storage.get_state(self._tenant_id) if not timestamp: month_start = ck_utils.local2utc(ck_utils.get_month_start()) return ck_utils.dt2ts(ck_utils.iso2dt(month_start)) now = ck_utils.utcnow_ts() if timestamp + self._period + self._wait_time < now: return timestamp return 0
def check_state(self): timestamp = self._storage.get_state(self._tenant_id) if not timestamp: month_start = ck_utils.get_month_start() return ck_utils.dt2ts(month_start) now = ck_utils.utcnow_ts() next_timestamp = timestamp + self._period if next_timestamp + self._wait_time < now: return next_timestamp return 0
def _check_state(self, tenant_id): timestamp = self.storage.get_state(tenant_id) if not timestamp: month_start = ck_utils.get_month_start() return ck_utils.dt2ts(month_start) now = ck_utils.utcnow_ts() next_timestamp = timestamp + CONF.collect.period wait_time = CONF.collect.wait_periods * CONF.collect.period if next_timestamp + wait_time < now: return next_timestamp return 0