Welcome Guest Search | Active Topics | Sign In | Register

Customized ResourceHandler Options
Touchway
Posted: Wednesday, August 9, 2017 8:48:49 AM
Rank: Member
Groups: Member

Joined: 8/5/2016
Posts: 17
Hi guys,
we build a custom resource handler for caching all files to local disc in order to serve them in case internet connection is lost
or the requested file is already existing. This is working very well for all kind of files. So far, so good.

There's a special case we have to delete all cache files in order to "renew" the cache.
If we delete cache files at the same moment a website is playing a video file,
the resource handler blocks the deletion process because of an open file pointer (it happens only with video files).
I figured out that the handler holds the file until the timeout interval (timeoutInSeconds) expires.

Code: C#
public CacheHandler(int timeOutInSeconds = 900, int writeBufferSize = 10240) : base(timeOutInSeconds, writeBufferSize);


Is there a way we can force the handler to release open file pointers?
We already tried to dispose the resource handler, destroy the webview, webcontrol, kill all browser child processes ecc. but nothing really worked.

Thanks
Lukas
eo_support
Posted: Thursday, August 10, 2017 3:05:12 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,201
Hi,

Please update to the latest build. This issue is addressed in build 2017.2.14 in the following manner:

1. When a WebView is destroyed, as pending custom resource handler is marked as canceled. Note that this does not terminate the resource handler. So if your Process method is running, it will still be running after this step;
2. When your code tries to call response.Write next, it will check for the canceled flag set in step 1 and throw if it is set. This provide a way for your Process method to exit cleanly;

As such you can put a try catch block around your code, an exception should be thrown once the WebView has been destroyed. You can then make sure the file is closed in your catch block and exit your Process method immediately afterwards.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.