Skip to content

Commit

Permalink
feat(metrics): hardcode matrix count to -1 as calculating it causes p…
Browse files Browse the repository at this point in the history
…erformance issues and it has no meaning
  • Loading branch information
bethesque committed Sep 15, 2023
1 parent 7829863 commit 62e121b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def self.included(anyway_config)
allow_missing_migration_files: true,
validate_database_connection_config: true,
database_statement_timeout: 15,
metrics_sql_statement_timeout: 30,
metrics_sql_statement_timeout: 30, # TODO get rid of this in next major version
database_connection_validation_timeout: nil
)

Expand Down
9 changes: 2 additions & 7 deletions lib/pact_broker/metrics/service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,9 @@ def verification_distribution
PactBroker::Pacts::PactPublication.db[query].all.each_with_object({}) { |row, hash| hash[row[:number_of_verifications]] = row[:pact_version_count] }
end

# This count has no real meaning and takes too long to do. Hardcode it to -1
def matrix_count
begin
PactBroker::Matrix::EveryRow.db.with_statement_timeout(PactBroker.configuration.metrics_sql_statement_timeout) do
PactBroker::Matrix::EveryRow.default_scope.count
end
rescue Sequel::DatabaseError => _ex
-1
end
-1
end
end
end
Expand Down

0 comments on commit 62e121b

Please sign in to comment.