0

I have a situation where I am iterating over a directory of files in Firefox with something like the following:

let iterator = OS.File.DirectoryIterator(dir);
let itPromise = iterator.forEach(entry){
return OS.File.read(entry.path).then(array => {
 return anotherPromise(array).then (
.
.
.
 }
});

return itPromise.then( function () {
//DO stuff after iterator is completely done
});

It seems like this iterator promise sometimes times out and never makes it to the //Do stuff after iterator line. If I am doing this for a small number of files, it seems to work fine - but if my iterator seems to take more than say, a minute (or some unknown magic number), the promise never returns. Is firefox doing something to shut down my OS.File iterator?

I read in a bug report here: https://bugzilla.mozilla.org/show_bug.cgi?id=1279389

that there is a osfile.reset_worker_delay preference, but I don't seem to be able to find that in Firefox 47, or any of the developer versions I downloaded.

Is that what is causing my problem - the iterator takes too long, and thus firefox wont skip to the next part?

0

I'm the author of DirectoryIterator.

  1. Normally, the only case in which something like a timeout should ever happen is if your code is executed during shutdown. Is this the case?

  2. Preference osfile.reset_worker_delay is available only on Nightly or Developer Edition. Yes, it's quite possible that there is a bug with this pref. If you could provide a minimal sample that we could reproduce, that would be very helpful. To test on your side, you could see what happens if you set the value to a very high number (say 1000000).

1
  • Ive had to create a work-around and restructure my code. If I get a chance, I can see if I can make a minimal test case, but it might not be for a bit. – Derek Oct 31 '16 at 1:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.