Skip to content

Commit 1a9b6fb

Browse files
committed
Update client and collection creation in two tasks
1 parent 6da3153 commit 1a9b6fb

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

profile/benchmarking/multi_doc.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def client
171171
end
172172

173173
def collection
174-
@collection ||= client[:corpus].tap { |coll| coll.create }
174+
@collection ||= begin; client[:corpus].tap { |coll| coll.create }; rescue Error::OperationFailure; client[:corpus]; end
175175
end
176176
alias :create_collection :collection
177177
end

profile/benchmarking/single_doc.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,11 @@ def insert_one(repetitions, do_repetitions, doc)
134134
end
135135

136136
def client
137-
@client ||= Mongo::Client.new(["localhost:27017"], database: 'perftest')
137+
@client ||= Mongo::Client.new(["localhost:27017"], database: 'perftest', monitoring: false)
138138
end
139139

140140
def collection
141-
@collection ||= client[:corpus].tap { |coll| coll.create }
141+
@collection ||= begin; client[:corpus].tap { |coll| coll.create }; rescue Error::OperationFailure; client[:corpus]; end
142142
end
143143
alias :create_collection :collection
144144
end

0 commit comments

Comments
 (0)