Skip to content

Commit

Permalink
fix(signal): AlwatrMultithreadContextSignal issue
Browse files Browse the repository at this point in the history
  • Loading branch information
alimd committed Jun 1, 2023
1 parent c6b40de commit 81cf1d8
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 15 deletions.
31 changes: 17 additions & 14 deletions cloud/alwatr/soffit-order/env/soffit-order.env
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
U2FsdGVkX19utyKMkhE4ZmeXOKYyMLrRwLLssEpByjjWw3vNO3CLHulQZm/y9qYN
3Nymgm9K/8OcJAbKvOdKH8CANly0E4nXTsnnmNdcX4Lp7SJ0uPLT7Bun64/34JZW
CzeBNAb5WxGCFva6KOyMqja0NjXSZEokIXVyt2DzaHOM6DqrBCN8TPNpJtKw0FQb
l8wboKuf6FRaW6MRLgnl394rbQr3NJ0AmhbM58UaotYYGPS+TV4vvLjDTNNfJvkV
ACL9h6xYEWdP0ub6Mk/pq6Mwa3dOks73BUCXMnitDhR2V11Ce9T88M2DkQ9YJAUJ
YH+GOxw5m8f0VBHRZwe/XWAdaZJRJxfCx39mJpSwUV4r6hX7aFkjxJ4R+xyATACL
L6jkcIkZFwtf+Cc4ITVjC7iQ8Xhh95PY5R0YgHrh/EeKCxPq4MqcTZX9ttlAy4Pq
f5J+lTCOY8ZAH9Dfm97Ll6BwyB/rHOvhyAhydVYD9hQiBNBP/LNyPZ5fYacNbL6x
Hd9JKIP2w/0UURptZoisVMngXDF5X2TNypFl4TRbYUsps7CRcNlhMymJq+veGfk9
SJCllxCVe3wJL+07nfRbQyHYZgsxPCbWER92yW4UPRfmRtWi5pClD7xtkUvq5kN0
esYHo+TIhEjn+DmQtF1HmfEKyQtY4rv598YyjNJ+LDCFGC9ZKNiOmXx6JDzTfoz4
Y59a+WjN5IJ3VO5nDTyr18EFDgDqJ6wxg+J7bQzmGH/HFvD/S5aeTCxbGVRjHmaK
yYn3Rux6wf9cr2xpZjEZaZrNbjeJ+QRJX0dalzyO6hsuNWCnIvFKrKNp8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cD15x9IJKkWKVN3f8KX6M=
5 changes: 4 additions & 1 deletion core/signal2/src/multithread-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type AlwatrContextChangedMessage = {
export class AlwatrMultithreadContextSignal<TValue> extends AlwatrContextSignal<TValue> {
protected static _logger = createLogger(`alwatr/mt-context`);
protected static _worker?: Worker;
protected static _registry: Record<string, AlwatrMultithreadContextSignal<unknown>> = {};
protected static _registry: Record<string, AlwatrMultithreadContextSignal<unknown> | undefined> = {};

static setupChannel(worker: Worker = self as unknown as Worker): void {
AlwatrMultithreadContextSignal._worker = worker;
Expand All @@ -26,6 +26,9 @@ export class AlwatrMultithreadContextSignal<TValue> extends AlwatrContextSignal<
if (message.type !== 'alwatr_context_changed') return;
AlwatrMultithreadContextSignal._logger.logMethodArgs?.('_onMessage', {message});
const context = AlwatrMultithreadContextSignal._registry[message.name];
if (context === undefined) {
throw new Error('context_not_define', {cause: 'context not define in this thread yet!'});
}
context._dispatch(message.payload);
}

Expand Down

0 comments on commit 81cf1d8

Please sign in to comment.