mirror of
https://github.com/gopl-zh/gopl-zh.github.com.git
synced 2026-02-08 02:42:46 +08:00
ch5: fix code path
This commit is contained in:
@@ -37,8 +37,8 @@ genesis: crashed: no parachute: G-switch failed: bad relay orientation
|
||||
|
||||
讓我們來看看處理錯誤的第二種策略。如果錯誤的發生是偶然性的,或由不可預知的問題導致的。一個明智的選擇是重新嚐試失敗的操作。在重試時,我們需要限製重試的時間間隔或重試的次數,防止無限製的重試。
|
||||
|
||||
<u><i>gopl.io/ch5/wait</i></u>
|
||||
```Go
|
||||
gopl.io/ch5/wait
|
||||
// WaitForServer attempts to contact the server of a URL.
|
||||
// It tries for one minute using exponential back-off.
|
||||
// It reports an error if all attempts fail.
|
||||
|
||||
Reference in New Issue
Block a user