Describe the bug
I'm an idiot and passed .release directly into a promise chains .finally()
sema.acquire().then(() => somethingAsync()).finally(sema.release)
this means i get this error
error: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading '#head')
if (this.#head) {
^
at release (https://jsr.io/@std/async/1.4.0/unstable_semaphore.ts:139:14)
at <anonymous>
however this somehow worked(?) but inconsistently. so it should be changed, by binding in the constructor this.release = this.release.bind(this), or by fixing whatever makes it inconsistently work. I have no idea why it sometimes works. Seems to have a higher chance of working when the semaphore max is higher, but it works even when the total number of acquire/release calls is more than max so idk.
Describe the bug
I'm an idiot and passed .release directly into a promise chains .finally()
this means i get this error
however this somehow worked(?) but inconsistently. so it should be changed, by binding in the constructor
this.release = this.release.bind(this), or by fixing whatever makes it inconsistently work. I have no idea why it sometimes works. Seems to have a higher chance of working when the semaphore max is higher, but it works even when the total number of acquire/release calls is more than max so idk.