Skip to content

Commit

Permalink
Fixed bug in VideoUploadSession with timeout and interval (#543)
Browse files Browse the repository at this point in the history
Summary:
I have no idea why but production code lacks 2 mandatory arguments when calling `VideoEncodingStatusChecker.waitUntilReady`. I have fixed it with the default values.
Pull Request resolved: #543

Reviewed By: codytwinton

Differential Revision: D15558296

Pulled By: jingping2015

fbshipit-source-id: e435fb6f
  • Loading branch information
adilkhash authored and facebook-github-bot committed Jun 3, 2019
1 parent b29bc58 commit 7a7df42
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.


## Unreleased
### Fix
[PR543](https://github.com/facebook/facebook-python-business-sdk/pull/543)

## v3.3.4

## v3.3.3
### Fix
Expand Down
8 changes: 6 additions & 2 deletions facebook_business/video_uploader.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def upload(self, video, wait_for_encoding=False):

class VideoUploadSession(object):

def __init__(self, video, wait_for_encoding=False):
def __init__(self, video, wait_for_encoding=False, interval=3, timeout=180):
self._video = video
self._api = video.get_api_assured()
if (video.Field.filepath in video):
Expand All @@ -86,6 +86,8 @@ def __init__(self, video, wait_for_encoding=False):
self._finish_request_manager = VideoUploadFinishRequestManager(
self._api,
)
self._timeout = timeout
self._interval = interval

def start(self):
# Run start request manager
Expand All @@ -108,7 +110,9 @@ def start(self):
)

if self._wait_for_encoding:
VideoEncodingStatusChecker.waitUntilReady(self._api, video_id)
VideoEncodingStatusChecker.waitUntilReady(
self._api, video_id, interval=self._interval, timeout=self._timeout
)

# Populate the video info
body = response.json().copy()
Expand Down

0 comments on commit 7a7df42

Please sign in to comment.