Skip to content

Commit

Permalink
[DONE] live event - export valeur vers conf + cast propriété (#959)
Browse files Browse the repository at this point in the history
* max attempt

* export param dans fichier de config
  • Loading branch information
mattbild authored Sep 22, 2023
1 parent 0c3b5aa commit 3867f66
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
6 changes: 4 additions & 2 deletions pod/live/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@

DEBUG = getattr(settings, "DEBUG", True)

EVENT_CHECK_MAX_ATTEMPT = getattr(settings, "EVENT_CHECK_MAX_ATTEMPT", 10)

logger = logging.getLogger(__name__)


Expand Down Expand Up @@ -188,7 +190,7 @@ def get_event_id_and_broadcaster_id(request):
return event_id, broadcaster_id


def check_size_not_changing(resource_path, max_attempt=6):
def check_size_not_changing(resource_path, max_attempt=EVENT_CHECK_MAX_ATTEMPT):
"""
Checks if the size of a resource remains unchanged over a specified number of attempts.
Args:
Expand Down Expand Up @@ -220,7 +222,7 @@ def check_size_not_changing(resource_path, max_attempt=6):
size_match = True


def check_exists(resource_path, is_dir, max_attempt=6):
def check_exists(resource_path, is_dir, max_attempt=EVENT_CHECK_MAX_ATTEMPT):
"""
Checks whether a file or directory exists.
Args:
Expand Down
2 changes: 1 addition & 1 deletion pod/live/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1022,7 +1022,7 @@ def create_video(event_id, current_file, segment_number):
except Exception as exc:
return JsonResponse(
status=500,
data={"success": False, "error": exc},
data={"success": False, "error": str(exc)},
)

segment = "(" + segment_number + ")" if segment_number else ""
Expand Down
13 changes: 13 additions & 0 deletions pod/main/configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -1031,6 +1031,19 @@
"pod_version_end": "",
"pod_version_init": "3.1"
},
"EVENT_CHECK_MAX_ATTEMPT": {
"default_value": 10,
"description": {
"en": [
""
],
"fr": [
"Nombre de tentatives maximum pour vérifier la présence / taille d'un fichier sur le filesystem"
]
},
"pod_version_end": "",
"pod_version_init": "3.4"
},
"HEARTBEAT_DELAY": {
"default_value": 45,
"description": {
Expand Down

0 comments on commit 3867f66

Please sign in to comment.