Skip to content
This repository has been archived by the owner on Nov 3, 2020. It is now read-only.

Reprompt to keep session alive for long downloads #59

Merged
merged 9 commits into from
Feb 9, 2019

Conversation

chokkyvista
Copy link
Contributor

A potential temporary working fix for #56 : keep reprompting users every 45 seconds or so (which you can override with ALEXA_REQUEST_TIMEOUT) for confirmation to keep the session from being timed out while the heroku server is busy downloading long videos.

image

@chokkyvista chokkyvista changed the title Reprompt to keep session alive for long videos Reprompt to keep session alive for long downloads Dec 30, 2018
});
}

function check_cache_ready(id, timeout) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This will periodically (per CACHE_POLLING_INTERVAL) check if the cache is ready up until timeout, when Alexa has to reprompt the user to avoid being timed out.

else {
wait_for_video(id, callback);
}
request(heroku + "/alexa/v3/cache/" + id, function(err, res, body) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've changed it from "wait and check" to "check and wait" to save the few seconds in case the cache should be already ready (e.g. from previous searches).

}
else {
else if (!interactive_wait) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

interactive_wait defaults to false to make it backward compatible.

@@ -1,14 +1,14 @@
module.exports = {
"en-US": {
"NO_RESULTS_FOUND": "{0} did not return any results on YouTube.",
"ASK_TO_PLAY": "I found a video called {0}. Would you like me to play it?",
"ASK_TO_PLAY": "I found a video called {0}. Would you like me to download it now?",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed "play" to "download" since there could be a long wait until the play finally starts. Also added "now" to the end to make "it" sound better 😃

@dmhacker
Copy link
Owner

I'll take a look this weekend! Thanks for the PR!

@dmhacker
Copy link
Owner

dmhacker commented Feb 8, 2019

@chokkyvista This looks pretty good! However, the backwards compatibility feature isn't really working: it just doesn't download for me. I'll fix this up and then accept the merge.

@dmhacker dmhacker merged commit 60d09bb into dmhacker:master Feb 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants