possible RxJs AsyncSubject bug
-
27 พฤศจิกายน 2554 7:36
Hi,
Using the current stable release, it looks like if you subscribe to an AsyncSubject while it is processing an onNext call, then the subscription never gets its value.
Here's a qunit test showing the problem. the "second subscription" never gets a value. The 1st, 3rd, and 4th subscriptions do get a value.
QUnit.asyncTest("AsyncSubject bug", 4, function () { var a = new Rx.AsyncSubject(), valueReceived = new Rx.Subject(); // each subscription signals this when it gets its value so we can end the test
// wait for 4 values to be received. valueReceived.Take(4).Timeout(1000).CatchErrorAndFailTest().FinallyStartQUnit().Subscribe();a.Subscribe(function (value) { QUnit.ok(true, "first subscription received value"); valueReceived.OnNext(value); // subscribe again a.Subscribe(function (value) { QUnit.ok(true, "second subscription received value"); valueReceived.OnNext(value); }); }); a.OnNext(1); a.OnCompleted(); a.Subscribe(function (value) { QUnit.ok(true, "third subscription received value"); valueReceived.OnNext(value); a.Subscribe(function (value) { QUnit.ok(true, "fourth subscription received value"); valueReceived.OnNext(value); }); }); });
This is the qunit output:Cdis.Rx.Extensions: AsyncSubject bug (1, 3, 4)Rerun
- first subscription received value (+0ms)
- third subscription received value (+0ms)
- fourth subscription received value (+0ms)
- Error: Timeout (+1006ms)
Is this a bug or intended behaviour?
- แก้ไขโดย bman654 27 พฤศจิกายน 2554 7:39
ตอบทั้งหมด
-
20 มีนาคม 2555 3:39
That is a bug and has been corrected in the version 1.0.10621.0 released back in December.
Thanks,
-- Matt- เสนอเป็นคำตอบโดย Matt Podwysocki 20 มีนาคม 2555 3:39
- ทำเครื่องหมายเป็นคำตอบโดย bman654 20 มีนาคม 2555 5:10
-
20 มีนาคม 2555 5:10Ahh I missed the new release. Thanks