Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/sherlock/collection.rb')
-rw-r--r--lib/gitlab/sherlock/collection.rb51
1 files changed, 0 insertions, 51 deletions
diff --git a/lib/gitlab/sherlock/collection.rb b/lib/gitlab/sherlock/collection.rb
deleted file mode 100644
index ce3a376cf75..00000000000
--- a/lib/gitlab/sherlock/collection.rb
+++ /dev/null
@@ -1,51 +0,0 @@
-# frozen_string_literal: true
-
-module Gitlab
- module Sherlock
- # A collection of transactions recorded by Sherlock.
- #
- # Method calls for this class are synchronized using a mutex to allow
- # sharing of a single Collection instance between threads (e.g. when using
- # Puma as a webserver).
- class Collection
- include Enumerable
-
- def initialize
- @transactions = []
- @mutex = Mutex.new
- end
-
- def add(transaction)
- synchronize { @transactions << transaction }
- end
-
- alias_method :<<, :add
-
- def each(&block)
- synchronize { @transactions.each(&block) }
- end
-
- def clear
- synchronize { @transactions.clear }
- end
-
- def empty?
- synchronize { @transactions.empty? }
- end
-
- def find_transaction(id)
- find { |trans| trans.id == id }
- end
-
- def newest_first
- sort { |a, b| b.finished_at <=> a.finished_at }
- end
-
- private
-
- def synchronize(&block)
- @mutex.synchronize(&block)
- end
- end
- end
-end