diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index ba11c3a75..bb7504888 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -25,7 +25,7 @@ def authenticate_system(skip_on_duplicated: false) if system_tokens_enabled? && request.headers.key?(SYSTEM_TOKEN_HEADER) @system.update(last_seen_at: Time.zone.now) headers[SYSTEM_TOKEN_HEADER] = @system.system_token - # only update last_seen_at each 3 minutes, + # only update last_seen_at each 3 minutes, # so that a system that calls SCC every second doesn't write + lock the database row elsif !@system.last_seen_at || @system.last_seen_at < 3.minutes.ago @system.touch(:last_seen_at) diff --git a/spec/requests/api/connect/base_controller_spec.rb b/spec/requests/api/connect/base_controller_spec.rb index 76b1f4b6b..8832909ea 100644 --- a/spec/requests/api/connect/base_controller_spec.rb +++ b/spec/requests/api/connect/base_controller_spec.rb @@ -65,7 +65,6 @@ def require_product shared_examples 'creates a duplicate system' do it 'creates a new System (duplicate)' do - expect { get :service, params: { id: 1 } } .to change { System.get_by_credentials(system.login, system.password).count } .by(1) @@ -182,7 +181,6 @@ def require_product include_examples 'does not create a duplicate system' include_examples "does not update the old system's token" - end context 'when the system has a token and the header is blank' do