diff --git a/ch6-cloud/ch6-02-lock.md b/ch6-cloud/ch6-02-lock.md index daeb425..9d9fad2 100644 --- a/ch6-cloud/ch6-02-lock.md +++ b/ch6-cloud/ch6-02-lock.md @@ -176,7 +176,7 @@ func incr() { // counter ++ getResp := client.Get(counterKey) cntValue, err := getResp.Int64() - if err == nil { + if err == nil || err == redis.Nil { cntValue++ resp := client.Set(counterKey, cntValue, 0) _, err := resp.Result()