Closed rod24574575 closed 5 years ago
I've tested couple of archives and I believe that is the actual byte order for files, I did noticed that archive readers (PeaZip) list files in opposite way but I don't know why anyways callback is fired as soon as file is extracted and we're reading archive from beginning to the end
Sorry for my poor way of expression. I mean the relationship between member function _postMessage() and _workerMsg() of Archive. _postMessage() would push callbacks to an array, while _workerMsg() retrieves callbacks from array last (first-in-last-out). I think that may result in matching wrong callback to messages from worker. Messages from worker should follow the sending order, so should _workerMsg() retrieve callbacks from array beginning?
Whenever webworker accepts message it will block until posts message back which means there should not really be more than one callback at a a time but anyways to be sure I have global lock too
https://github.com/nika-begiashvili/libarchivejs/blob/master/src/webworker/worker.js#L5 . keep in mind that each archive has it's own webworker so working with multiple archives doesn't block each other.
I understand complexity of this implementation and I'm planning switching to https://github.com/GoogleChromeLabs/comlink
but if you think that there is a bug please try to come up with steps to reproduce
I found that callbacks are called by first-in-last-out. Should it be first-in-first-out?