Highlighted

Writing in app-storage directory inside Worker

Explorer ,
Jan 06, 2016

Copy link to clipboard

Copied

Hi there,

In my Adobe AIR app (desktop), I wrote a FileDownloader class that use insternally a FileStream instance to write remote files into the application storage directory

The problem is that the UI freezes during the download process (even though i opened the local file asynchronously)

As a workaround, I thought it could be a good idea to use a Worker to download those files, but when I try to write them inside the app-storage directory from my Worker thread,

the Worker writes it in this folder : %appdata%\[Worker].null\Local Store

As you can see, the app-storage directory is inside this folder named "[Worker].null"  instead of being in my real app-storage dir (named by my app identifier)

A solution I found is to write the downloaded files to a tmp file, and then, in the main Worker Thread, use moveToAsync to move the file to my app-storage directory, but it's not very clean... and moveToAsync takes time with large files...

Anyone has experienced this issue?

Is it the normal behavior or is it a bug? I think the Worker should have the same app-storage directory as the application that embed it (especially when you set giveAppPrivileges=true in createWorker method)

Thanks

(and sorry for my english)

Hi,

Having worked with multiple Workers on my own project, I have experienced the very same behaviour.

The solution I found was to set a shared property on the worker, with the native path of the app.

So, on the primordial worker, you get the applicationStorageDirectory native path, and then set the shared property on the worker.

hope it helps.

regards,

Leo

TOPICS
Performance issues

Views

507

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Writing in app-storage directory inside Worker

Explorer ,
Jan 06, 2016

Copy link to clipboard

Copied

Hi there,

In my Adobe AIR app (desktop), I wrote a FileDownloader class that use insternally a FileStream instance to write remote files into the application storage directory

The problem is that the UI freezes during the download process (even though i opened the local file asynchronously)

As a workaround, I thought it could be a good idea to use a Worker to download those files, but when I try to write them inside the app-storage directory from my Worker thread,

the Worker writes it in this folder : %appdata%\[Worker].null\Local Store

As you can see, the app-storage directory is inside this folder named "[Worker].null"  instead of being in my real app-storage dir (named by my app identifier)

A solution I found is to write the downloaded files to a tmp file, and then, in the main Worker Thread, use moveToAsync to move the file to my app-storage directory, but it's not very clean... and moveToAsync takes time with large files...

Anyone has experienced this issue?

Is it the normal behavior or is it a bug? I think the Worker should have the same app-storage directory as the application that embed it (especially when you set giveAppPrivileges=true in createWorker method)

Thanks

(and sorry for my english)

Hi,

Having worked with multiple Workers on my own project, I have experienced the very same behaviour.

The solution I found was to set a shared property on the worker, with the native path of the app.

So, on the primordial worker, you get the applicationStorageDirectory native path, and then set the shared property on the worker.

hope it helps.

regards,

Leo

TOPICS
Performance issues

Views

508

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Jan 06, 2016 0
Explorer ,
Jan 20, 2016

Copy link to clipboard

Copied

Hi,

Having worked with multiple Workers on my own project, I have experienced the very same behaviour.

The solution I found was to set a shared property on the worker, with the native path of the app.

So, on the primordial worker, you get the applicationStorageDirectory native path, and then set the shared property on the worker.

hope it helps.

regards,

Leo

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jan 20, 2016 1
Explorer ,
Jan 21, 2016

Copy link to clipboard

Copied

Awesome, I didn't think about that

Thanks a lot

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jan 21, 2016 0
Explorer ,
Jan 21, 2016

Copy link to clipboard

Copied

But I do agree with you, that all workers should share the same keyword based folders.

In the end: applicationStorageDirectory refers to the Application, and your Worker is part of the Application.

To me, all Workers should point to the same path if using such "magic paths".

chris.campbell - perhaps you could check it?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jan 21, 2016 0