cleanup method

void cleanup()

Implementation

void cleanup() {
  final now = DateTime.now();
  _requests.removeWhere((key, timestamps) {
    while (timestamps.isNotEmpty &&
        now.difference(timestamps.first) > duration) {
      timestamps.removeAt(0);
    }
    return timestamps.isEmpty;
  });
}