getndazn / kopytko-utils

A collection of modern utility functions for Brightscript applications
MIT License
6 stars 4 forks source link

CacheFS Error #27

Open alexkn1 opened 8 months ago

alexkn1 commented 8 months ago

Was this tested in a library component. Typically library components don't have access to the file system.

BRIGHTSCRIPT: ERROR: roFilesystem: creating MAIN|TASK-only component failed on RENDER thread: pkg:/components/kopytko_modules/dazn_kopytkoUtils_v2/CacheFS.brs(16)

Suspending threads... Thread selected: 1* ...n_kopytkoUtils_v2/CacheFS.brs(19) if (NOT m._fileSystem.exists(m._PREFIX + m._folder)) then m._createFolder()

pawelhertman commented 8 months ago

It was never tested as a library component because, if not used with Kopytko Packager, it requires manual file imports anyway. If you used CacheFS on the render thread, you used it incorrectly. There is a warning in the code: https://github.com/getndazn/kopytko-utils/blob/master/src/components/CacheFS.brs#L3

Summarizing, it's not an issue. //cc @bchelkowski

alexkn1 commented 7 months ago

@pawelhertman

I am not using it directly, I believe: ' @import /components/http/HttpService.brs from @dazn/kopytko-framework or some other parts of the framework is using it, anyway to disable it?

m._port = CreateObject("roMessagePort") m._httpService = HttpService(m._port)

feat!: Add HTTP request and support HTTP caching (https://github.com/getndazn/kopytko-framework/pull/49) (1a09ae8), closes https://github.com/getndazn/kopytko-framework/issues/49 BREAKING CHANGES (Versions Migration) New HttpRequest node extending current base Request task node

It worked prior to this version (before 2.0)

Thanks!

tomek-r commented 7 months ago

Hi, @alexkn1 can you give some info about your use case? HttpService.brs is used with Task nodes, not on render thread.

bchelkowski commented 7 months ago

Hi,

We are guessing, as there is a bit little information, but from what you wrote I assume that you are migrating kopytko-framework from v1 to v2.

In v2, the HttpRequest component has been added (that's why we marked it as a breaking change, as it could be a name that is already used in a project) and this could be your case. If you want to use v2, you need to either change the name of your HttpRequest, or start using one from the framework (extend now your requests from HttpRequest, not the Request), the latter will require some adjustments.

The second thing is that one mentioned by Pawel and Tomek, that HttpService.brs needs to be run in a task thread. With v2 this is included in the HttpRequest Task, so it could be simply done by extending your request from HttpRequest and then calling createRequest("YourRequestExtendingKopytkoFrameworkHttpRequest").

Here is documentation related to a new HttpRequest