Skip to content

Conversation

@PeekLeon
Copy link

Fix timeout error after 4 hours and improve log resumption

Description:

  • Fixes the timeout error occurring after 4 hours.
  • Implements reconnection every 30 minutes.
  • Logs no longer restart from the beginning but resume from where they stopped.

Environment for Testing

  • Rundeck Version: 5.10.0
  • Plugin Version: 2.0.14

@PeekLeon
Copy link
Author

Hi there,

I wanted to check in on this PR to see if there’s any chance to get it reviewed or merged.
Also, I was wondering if the project is still supported.

Thanks a lot for your time, and please let me know if there’s anything I can adjust to help move it forward.

@fdevans fdevans requested a review from Copilot August 26, 2025 18:46
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a timeout error that occurs after 4 hours by implementing periodic reconnections every 30 minutes and improving log resumption to avoid restarting from the beginning.

  • Implements a 30-minute connection timeout with automatic reconnection
  • Adds log line tracking to resume from the last processed line instead of restarting
  • Introduces connection state management to control retry behavior during reconnections

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.



def wait():
connection_max_time = 1800 # time in seconds
Copy link

Copilot AI Aug 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The magic number 1800 should be defined as a named constant (e.g., CONNECTION_TIMEOUT_SECONDS = 1800) to improve code maintainability and make the 30-minute timeout more explicit.

Suggested change
connection_max_time = 1800 # time in seconds
connection_max_time = CONNECTION_TIMEOUT_SECONDS

Copilot uses AI. Check for mistakes.

log.info("Waiting for job completion")
time.sleep(sleep)
if current_line_number > last_line_number or last_line_number == 0:
Copy link

Copilot AI Aug 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This condition will skip the first line when resuming (when last_line_number > 0). The condition should be 'current_line_number >= last_line_number' to avoid missing lines during log resumption.

Suggested change
if current_line_number > last_line_number or last_line_number == 0:
if current_line_number >= last_line_number:

Copilot uses AI. Check for mistakes.
Comment on lines +100 to +102
last_line_number = current_line_number

current_line_number += 1
Copy link

Copilot AI Aug 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The last_line_number is being set to current_line_number inside the if block, but current_line_number is incremented after this assignment. This will cause the next reconnection to skip one line. Move this assignment after the current_line_number increment or use current_line_number + 1.

Suggested change
last_line_number = current_line_number
current_line_number += 1
current_line_number += 1
last_line_number = current_line_number

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant