Deletes ClientStats older than a given timestamp.
767652
def DeleteOldClientStats(self, yield_after_count,
                           retention_time
                          ):
    """"""

    yielded = False

    while True:
      deleted_count = self._DeleteClientStats(
          limit=yield_after_count, retention_time=retention_time)

      # Do not yield a trailing 0 after any non-zero count has been yielded.
      # A trailing zero occurs, when an exact multiple of `yield_after_count`
      # rows were in the table.
      if not yielded or deleted_count > 0:
        yield deleted_count
        yielded = True

      # Return, when no more rows can be deleted, indicated by a transaction
      # that does not reach the deletion limit.
      if deleted_count < yield_after_count:
        return
255555
def cleanup_full_hashes(self, keep_expired_for=(60 * 60 * 12)):
        """"""
        q = '''DELETE FROM full_hash WHERE expires_at < datetime(current_timestamp, '-{} SECONDS')
        '''
        log.info('Cleaning up full_hash entries expired more than {} seconds ago.'.format(keep_expired_for))
        with self.get_cursor() as dbc:
            dbc.execute(q.format(int(keep_expired_for)))
1018912
@Override
    @Transactional(MillJpaRepoConfig.TRANSACTION_MANAGER_BEAN)
    public void purgeExpired() {
        log.info("flushing all written log entries over {} days old.", ageInDaysOfPurgeableWrittenLogEntries);

        Calendar c = Calendar.getInstance();
        c.add(Calendar.DATE, ageInDaysOfPurgeableWrittenLogEntries * -1);
        Date date = c.getTime();
        long deleted = this.repo.deleteByWrittenTrueAndTimestampLessThan(date.getTime());
        log.info("successfully deleted {} audit log entries that had been written and were timestamped before {}",
                 deleted, date);

    }
140016
def discard_last(self, indices):
        """"""
        for i in indices:
            self.buffer_expire[i] = self.buffer_expire[i][:-1]
            self.buffer[i] = self.buffer[i][:-1]
1079169
def remove(self, w):
        ''''''
        self.wpoints.remove(w)
        self.last_change = time.time()
        self.reindex()
989947
private void cleanup() {
        StatsDataReference ref = null;
        while ((ref = (StatsDataReference) statisticsReferenceQueue.poll()) != null) {
            StatsData oldStats = null;
            StatsData updatedStats = null;
            do {
                oldStats = terminatedThreadStats.get();
                updatedStats = aggregateStats(oldStats, ref.statsData);
            } while (!terminatedThreadStats.compareAndSet(oldStats, updatedStats));
            allReferences.remove(ref);
        }
    }
754792
private void cleanUsingTime(final String metricName, final Date firstAllowedDate) {
    if (this.historyListMapping.containsKey(metricName)
        && this.historyListMapping.get(metricName) != null) {
      synchronized (this.historyListMapping.get(metricName)) {

        InMemoryHistoryNode firstNode = this.historyListMapping.get(metricName).peekFirst();
        long localCopyOfTimeWindow = 0;

        // go ahead for clean up using latest possible value of interval
        // any interval change will not affect on going clean up
        synchronized (this) {
          localCopyOfTimeWindow = this.timeWindow;
        }

        // removing objects older than Interval time from firstAllowedDate
        while (firstNode != null
            && TimeUnit.MILLISECONDS
            .toMillis(firstAllowedDate.getTime() - firstNode.getTimestamp().getTime())
            > localCopyOfTimeWindow) {
          this.historyListMapping.get(metricName).removeFirst();
          firstNode = this.historyListMapping.get(metricName).peekFirst();
        }
      }
    }
  }
560859
synchronized void clearStats() {
    for (Entry<String, Collection<MutableViewData>> entry : mutableMap.asMap().entrySet()) {
      for (MutableViewData mutableViewData : entry.getValue()) {
        mutableViewData.clearStats();
      }
    }
  }
1061170
synchronized int removeOldConnections() {
        long now = System.currentTimeMillis();
        long expirationTime = now - idleTransportTimeout.millis();

        List<PooledTransport> removeFromIdle = new ArrayList<PooledTransport>();
        for (Map.Entry<PooledTransport, Long> idleEntry : idle.entrySet()) {
            long lastUsed = idleEntry.getValue();
            if (lastUsed < expirationTime) {
                PooledTransport removed = idleEntry.getKey();
                if (log.isTraceEnabled()) {
                    log.trace("Expiring idle transport for job [" + jobPoolingKey + "], transport: ["
                            + removed.toString() + "]. Last used [" + new TimeValue(now-lastUsed) + "] ago. Expired ["
                            + idleTransportTimeout + "] ago.");
                }
                release(removed);
                removeFromIdle.add(removed);
            }
        }

        for (PooledTransport toRemove : removeFromIdle) {
            idle.remove(toRemove);
        }

        return idle.size() + leased.size();
    }
855941
def UnfreezeTimestamp(self):
    """"""
    if not self.prev_frozen_timestamps:
      raise RuntimeError("Unbalanced UnfreezeTimestamp call.")
    self.frozen_timestamp = self.prev_frozen_timestamps.pop()
751560
def remove_old_dumps(connection, container: str, days=None):
    

    if not days:
        return

    if days < 20:
        LOG.error('A minimum of 20 backups is stored')
        return

    options = return_file_objects(connection, container)

    for dt, o_info in options:
        now = datetime.datetime.now()
        delta = now - dt
        if delta.days > days:
            LOG.info('Deleting %s', o_info['name'])
            objectstore.delete_object(connection, container, o_info)
512552
protected void removeExpired(Map<Integer, Context> contexts) {
        Iterator<Context> contextsIter = contexts.values().iterator();
        while (contextsIter.hasNext()) {
            Context context = contextsIter.next();
            if (context.completeMoment != null
                    && System.currentTimeMillis() - context.completeMoment > contextTimeout) {
                contextsIter.remove();
            }
        }
    }
661665
def ReadClientStats(self, client_id,
                      min_timestamp,
                      max_timestamp
                     ):
    """"""
    results = []
    for timestamp, stats in iteritems(self.client_stats[client_id]):
      if min_timestamp <= timestamp <= max_timestamp:
        results.append(stats)
    return results
303745
def _cleanSessions(self):
        
        tooOld = extime.Time() - timedelta(seconds=PERSISTENT_SESSION_LIFETIME)
        self.store.query(
            PersistentSession,
            PersistentSession.lastUsed < tooOld).deleteFromStore()
        self._lastClean = self._clock.seconds()
573477
def cleanup(self):
        
        now = time.time()
        expired = now - NODE_TIMEOUT
        if self.conn.zremrangebyscore(self.key, 0, expired):
            self._notify()
350195
public function deleteOldSessions(int $max_age_in_seconds): void
    {
        $timestamp = Carbon::now()->subSeconds($max_age_in_seconds);

        DB::table('session')
            ->where('session_time', '<', $timestamp)
            ->delete();
    }
638209
public void cleanup() {
		long currentTime = System.currentTimeMillis();

		// remove entries which have exceeded their time to live
		cachedExecutionGraphs.values().removeIf(
			(ExecutionGraphEntry entry) -> currentTime >= entry.getTTL());
	}