Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a configurable wait period for shared resource #17464

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions conf/robottelo.yaml.template
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ ROBOTTELO:
IGNORE_VALIDATION_ERRORS: false
# Stage docs url
STAGE_DOCS_URL: https://docs.redhat.com
SHARED_RESOURCE_WAIT: 2
1 change: 1 addition & 0 deletions robottelo/config/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@
default=[],
cast=lambda x: list(map(str, x)),
),
Validator('robottelo.shared_resource_wait', default=60, is_type_of=int),
Copy link
Member

Choose a reason for hiding this comment

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

To allow the time to be lower than 1 second

Suggested change
Validator('robottelo.shared_resource_wait', default=60, is_type_of=int),
Validator('robottelo.shared_resource_wait', default=60, cast=float),

],
shared_function=[
Validator('shared_function.storage', is_in=('file', 'redis'), default='file'),
Expand Down
4 changes: 3 additions & 1 deletion robottelo/utils/shared_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@

from broker.helpers import FileLock

from robottelo.config import settings


class SharedResourceError(Exception):
"""An exception class for SharedResource errors."""
Expand Down Expand Up @@ -120,7 +122,7 @@ def _wait_for_main_watcher(self):
while True:
curr_data = json.loads(self.resource_file.read_text())
if curr_data["main_status"] != "done":
time.sleep(60)
time.sleep(settings.robottelo.shared_resource_wait)
elif curr_data["main_status"] == "action_error":
self._try_take_over()
elif curr_data["main_status"] == "error":
Expand Down