Skip to content

Commit

Permalink
Merge pull request #4192 from vespa-engine/hmusum/adjust-wait-time-fo…
Browse files Browse the repository at this point in the history
…r-deleting-session

Decide wait time for deleting session based on session lifetime and m…
  • Loading branch information
Arnstein Ressem authored Sep 6, 2024
2 parents 03378d1 + 08db28e commit 6381d71
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions tests/config/deploy/deploy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -384,8 +384,8 @@ def run_old_sessions_are_deleted(session_id=@session_id)
session_id = deploy_and_activate_session_v2("#{CONFIG_DEPLOY_APPS}/app_c", session_id, 1339)

# Check that all sessions have been deleted, except the active one
wait_until_local_session_deleted(session_id_a)
wait_until_local_session_deleted(session_id_b)
wait_until_local_session_deleted(session_id_a, session_lifetime)
wait_until_local_session_deleted(session_id_b, session_lifetime)
assert_exists(session_id_c)

set_config_server_config()
Expand Down Expand Up @@ -529,11 +529,12 @@ def local_session_exists(session_id)
exitcode == "0"
end

def wait_until_local_session_deleted(session_id)
# SessionsMaintainer is set to run every minute (see call to write_default_config_server_config in setup())
def wait_until_local_session_deleted(session_id, session_lifetime)
session_exists = true
# Wait for some time longer than maintainer interval, since config server might not have observed that session has been deactivated on first run
190.times do |i|
# Wait for some time longer than max(session lifetime, maintainer interval (30 secs)), since config
# server might not have observed that session has been deactivated on first run
iterations = [session_lifetime * 2, 30].max
iterations.times do |i|
session_exists = local_session_exists(session_id)
break if !session_exists
sleep 1
Expand Down

0 comments on commit 6381d71

Please sign in to comment.