Function Timeout

I have a function that times-out if it runs more than 25 seconds.

 

Is this something built in to the Plex Framework or is it a Python thing?

 

Thanks!

I believe that’s a Plex thing. 25 seconds is an eternity to wait for a function to return a result. If you want something to run in the background, there is framework support for threading http://dev.plexapp.com/docs/api/threadkit.html

I saw the threading but it didn't look like what I wanted to do.

I have to make 2 calls to a server, so it takes a while to get all the results.

The function builds a menus so I think I'd be better off waiting for the results, wouldn't I?

I saw the threading but it didn't look like what I wanted to do.

I have to make 2 calls to a server, so it takes a while to get all the results.

The function builds a menus so I think I'd be better off waiting for the results, wouldn't I?

Is there a way you can break up the requests so that you can return something more quickly? From a user standpoint, that is a long time to wait for something to happen.

I agree, 25 seconds is a long time to wait... but if I could set the timeout to 30 seconds it would work.

Plus, I'm not 100% sure how I could separate the calls, since the second call I have to do gets the url of the stream.

Mike, could the trick you showed me for pulling images in the MTV.bundle (https://github.com/shopgirl284/MTVShows.bundle/blob/master/Contents/Code/__init__.py#L108) be something FredenFromSweden could use here? Adding one of the server calls as a separate function and then calling it within the first function's DirectoryObject() with Redirect? 

Also, sorry to hijack the thread, but Mike could you recommend an example of a channel using threading to see it in action?

I agree, 25 seconds is a long time to wait... but if I could set the timeout to 30 seconds it would work.

Plus, I'm not 100% sure how I could separate the calls, since the second call I have to do gets the url of the stream.

If you're just building the navigation you should not worry about any stream URLs, yet. That's the job for the URL Service or, if you're not using a URL Service, for another Callback function that's executed at the moment a user want to play a video.

if you're not using a URL Service, for another Callback function that's executed at the moment a user want to play a video.

I am not using a URL Service and I was thinking the same thing.

Since this framework is all new to me I can't image how to do that. Could you provide a simple example or a plugin that does that so I can see how to do it?

Thanks!

If you're just building the navigation you should not worry about any stream URLs, yet. That's the job for the URL Service or, if you're not using a URL Service, for another Callback function that's executed at the moment a user want to play a video.

This.

Mike, could the trick you showed me for pulling images in the MTV.bundle (https://github.com/shopgirl284/MTVShows.bundle/blob/master/Contents/Code/__init__.py#L108) be something FredenFromSweden could use here? Adding one of the server calls as a separate function and then calling it within the first function's DirectoryObject() with Redirect? 

Also, sorry to hijack the thread, but Mike could you recommend an example of a channel using threading to see it in action?

Using a callback to asynchronously populate a thumbnail image is possible because the framework allows for that. It's not possible to asynchronously load other metadata fields (such as summary, title, etc.) because the framework requires all that data to be present when building the object. Images are handled differently because they often take longer to load and can be a real stumbling bock in terms of load times.

As far as examples of threading goes, the only one that I'm aware of currently is the Unsupported Appstore.

Since this framework is all new to me I can't image how to do that. Could you provide a simple example or a plugin that does that so I can see how to do it?

Never mind... I found sander1's reply in the 'Ways to deal with timeouts' post which is just what I needed.

Thanks guys (and shopgirl)!

I now have it working the way sander1 suggested in the 'Ways to deal with timeouts' post - but is has stopped working on Plex/Web and iOS.

Before I go too far trying to figure out if it my problem, would anyone know if it's related to this;

http://forums.plexapp.com/index.php/topic/40532-bug-http-live-streaming-doesnt-work-when-redirected/

And again - thank you all for your help!

M

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.