JavaScript Promiseの本 v1raceとdelayによるXHRのキャンセル このセクションでは2章で紹介した Promise.race のユースケースとして、 Promise.raceを 使ったタイムアウトの実装を学んでいきます。 もちろんXHRは timeout72 プロパティを持っているので、 これを利用すると簡単にできま すが、複数のXHRを束ねたタイムアウトや他の機能でも応用が効くため、 分かりやすい非 同期処理であるXHRにおけるタイムアウトによるキャンセルを例にしています。 simple-timeout-promise.js function delayPromise(ms) { return new Promise(function (resolve) { setTimeout(resolve, ms); }); } function timeoutPromise(promise, ms) { var timeout = delayPromise(ms) Error('Operation timed out after ' + ms + ' ms'); }); return Promise.race([promise, timeout]); } timeoutPromise(比較対象のpromise, ms) はタイムアウト処理を入れたい promiseオ ブジェクトとタイムアウトの時間を受け取り、 Promise.race0 码力 | 115 页 | 1.06 MB | 1 年前3
JavaScript Promiseの本 v2raceとdelayによるXHRのキャンセル このセクションでは2章で紹介した Promise.race のユースケースとして、 Promise.raceを 使ったタイムアウトの実装を学んでいきます。 もちろんXHRは timeout80 プロパティを持っているので、 これを利用すると簡単にできま すが、複数のXHRを束ねたタイムアウトや他の機能でも応用が効くため、 分かりやすい非 同期処理であるXHRにおけるタイムアウトによるキャンセルを例にしています。 simple-timeout-promise.js function delayPromise(ms) { return new Promise((resolve) => { setTimeout(resolve, ms); }); } function timeoutPromise(promise, ms) { const timeout = delayPromise(ms) new Error("Operation timed out after " + ms + " ms"); }); return Promise.race([promise, timeout]); 84 JavaScript Promiseの本 } timeoutPromise(比較対象のpromise, ms) はタイムアウト処理を入れたい promiseオ ブジェクトとタイムアウトの時間を受け取り、0 码力 | 137 页 | 1.17 MB | 1 年前3
KiCad 8.0 Schematic Editor"type": "odbc", "dsn": "", "username": "", "password": "", "timeout_seconds": 2, "connection_string": "" }, "libraries": [ { Users have the option to configure two timeout settings. The timeout_parts_seconds setting dictates the validity duration of a part’s information, while the timeout_categories_seconds setting determines important to note that KiCad will re-cache the data on the initial startup regardless of these timeout settings. 163 Authentication Authentication is done via an Access Token only. Users need to ask0 码力 | 194 页 | 7.86 MB | 1 年前3
Comprehensive Rust(日语) 202412Some(msg) = rx.recv() => println!("got: {msg}"), _ = sleep(Duration::from_millis(50)) => println!("timeout"), }; }); sleep(Duration::from_millis(10)).await; tx.send(String::from("Hello!")).await.expect("Failed failed"); } • The listener async block here is a common form: wait for some async event, or for a timeout. Change the sleep to sleep longer to see it fail. Why does the send also fail in this situation? に追加しただけでは、実行されません。なぜでしょうか? – 代わりに、loop の外側で、その Future を含む timeout_fut を追加します。 let timeout_fut = sleep(Duration::from_millis(100)); loop { select! { .., _ = timeout_fut => { println!(..); }, } } – こ れ で も う ま0 码力 | 381 页 | 1.36 MB | 10 月前3
PlantUML 1.2020.23 言語リファレンスガイド10.1 Note on field or method @startuml class A { {static} int counter +void {abstract} start(int timeout) } note right of A::counter This member is annotated end note note right of A::start This method start(Duration timeout) } note left of A::counter This member is annotated end note note right of A::"start(int timeoutms)" This method with int end note note right of A::"start(Duration timeout)" This method0 码力 | 306 页 | 3.19 MB | 1 年前3
PlantUML を使った UML の描き方 - PlantUML 言語リファレンスガイド(Version 1.2021.1)。 3.10.1 フィールドまたはメンバーへの注釈 @startuml class A { {static} int counter +void {abstract} start(int timeout) } note right of A::counter This member is annotated end note note right of A::start This method start(Duration timeout) } note left of A::counter This member is annotated end note note right of A::"start(int timeoutms)" This method with int end note note right of A::"start(Duration timeout)" This method0 码力 | 393 页 | 4.27 MB | 1 年前3
PlantUML を使った UML の描き方 - PlantUML 言語リファレンスガイド(Version 1.2021.2)。 3.10.1 フィールドまたはメンバーへの注釈 @startuml class A { {static} int counter +void {abstract} start(int timeout) } note right of A::counter This member is annotated end note note right of A::start This method start(Duration timeout) } note left of A::counter This member is annotated end note note right of A::"start(int timeoutms)" This method with int end note note right of A::"start(Duration timeout)" This method0 码力 | 399 页 | 4.33 MB | 1 年前3
PlantUML 1.2021.3 言語リファレンスガイド。 3.10.1 フィールドまたはメンバーへの注釈 @startuml class A { {static} int counter +void {abstract} start(int timeout) } note right of A::counter This member is annotated end note note right of A::start This method start(Duration timeout) } note left of A::counter This member is annotated end note note right of A::"start(int timeoutms)" This method with int end note note right of A::"start(Duration timeout)" This method0 码力 | 412 页 | 4.46 MB | 1 年前3
PlantUML を使った UML の描き方 - PlantUML 言語リファレンスガイド(Version 1.2023.11)に設定した場合、この機能は使えません。 3.11.2 フィールドまたはメンバーへの注釈 @startuml class A { {static} int counter +void {abstract} start(int timeout) } note right of A::counter This member is annotated end note note right of A::start This method start(Duration timeout) } note left of A::counter This member is annotated end note note right of A::"start(int timeoutms)" This method with int end note note right of A::"start(Duration timeout)" This method0 码力 | 545 页 | 7.75 MB | 1 年前3
Krita 5.2 マニュアル
Rendering Timeout To prevent Krita from hanging on a single frame, we limit how long it can spend on rendering a frame before moving on the next. If rendering an animation fails very often due a timeout, you0 码力 | 1591 页 | 79.16 MB | 1 年前3
共 10 条
- 1













