@konemono/nostr-login 1.7.32 → 1.7.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/src/modules/Nip46.ts
CHANGED
|
@@ -155,6 +155,7 @@ class NostrRpc extends NDKNostrRpc {
|
|
|
155
155
|
);
|
|
156
156
|
|
|
157
157
|
const connectedRelays = relays.filter(r => r.status === 1);
|
|
158
|
+
console.log('connected relays', connectedRelays);
|
|
158
159
|
|
|
159
160
|
if (connectedRelays.length === 0) {
|
|
160
161
|
console.log('No connected relays, forcing reconnection...');
|
|
@@ -262,6 +263,7 @@ class NostrRpc extends NDKNostrRpc {
|
|
|
262
263
|
|
|
263
264
|
const timeoutId = setTimeout(() => {
|
|
264
265
|
if (this.requests.has(id)) {
|
|
266
|
+
clearTimeout(timeoutId);
|
|
265
267
|
this.requests.delete(id);
|
|
266
268
|
this.requestTimeouts.delete(id);
|
|
267
269
|
console.log('NIP46 request timeout for', id);
|
|
@@ -40,7 +40,7 @@ class ProcessManager extends EventEmitter {
|
|
|
40
40
|
if (!this.callTimer) {
|
|
41
41
|
this.callTimer = setTimeout(() => {
|
|
42
42
|
console.log('ProcessManager: timeout reached, emitting onCallTimeout');
|
|
43
|
-
this.callTimer = undefined; // タイムアウト時にタイマーIDをクリア
|
|
43
|
+
this.callTimer = undefined; // ★ タイムアウト時にタイマーIDをクリア
|
|
44
44
|
this.emit('onCallTimeout');
|
|
45
45
|
}, CALL_TIMEOUT);
|
|
46
46
|
console.log(`Setting up timeout timer for ${CALL_TIMEOUT} ms`);
|
|
@@ -52,30 +52,41 @@ class ProcessManager extends EventEmitter {
|
|
|
52
52
|
|
|
53
53
|
this.callCount++;
|
|
54
54
|
|
|
55
|
-
let error;
|
|
56
|
-
let result;
|
|
55
|
+
let error: any; // 型をanyに変更
|
|
56
|
+
let result: any;
|
|
57
57
|
|
|
58
|
+
// 非同期処理の実行
|
|
58
59
|
try {
|
|
59
60
|
result = await cb();
|
|
60
61
|
} catch (e) {
|
|
61
62
|
error = e;
|
|
62
63
|
}
|
|
63
64
|
|
|
65
|
+
// ★ 修正後のクリーンアップロジック (finallyブロック相当)
|
|
66
|
+
// ----------------------------------------------------
|
|
67
|
+
|
|
68
|
+
// ProcessManagerの呼び出しカウントをデクリメント
|
|
64
69
|
this.callCount--;
|
|
65
70
|
this.emit('onCallEnd');
|
|
66
71
|
|
|
72
|
+
// タイマーがまだ存在していればクリアし、IDもクリア
|
|
73
|
+
// この処理は、cb()が成功/失敗したどちらの場合でも実行される
|
|
67
74
|
if (this.callTimer) {
|
|
68
75
|
clearTimeout(this.callTimer);
|
|
69
76
|
}
|
|
70
77
|
this.callTimer = undefined; // ProcessManager のタイマーIDもここでクリア
|
|
71
78
|
|
|
79
|
+
// ----------------------------------------------------
|
|
80
|
+
|
|
81
|
+
// エラーがあればスローし、呼び出し元に伝播させる
|
|
72
82
|
if (error) {
|
|
73
83
|
throw error;
|
|
74
84
|
}
|
|
75
85
|
|
|
76
86
|
// @ts-ignore
|
|
77
|
-
return result;
|
|
87
|
+
return result as T;
|
|
78
88
|
}
|
|
89
|
+
|
|
79
90
|
public pause() {
|
|
80
91
|
if (this.callTimer) clearTimeout(this.callTimer);
|
|
81
92
|
this.callTimer = undefined;
|