Repository navigation
Conversation
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- funlen: shutdown処理を関数に切り出し - gocritic: log.Fatalf前にdeferされたteardownを明示的に呼び出し - mnd: マジックナンバーを定数に切り出し Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
log.Fatalf→log.Printf+returnに変更し、deferが正常に実行されるようにする Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
kyu08
commented
Apr 6, 2026
|
|
||
| select { | ||
| case <-stopped: | ||
| logger.Info("gRPC server stopped gracefully") |
Owner
Author
There was a problem hiding this comment.
ここのメッセージがこれでいいか意見ください!
gRPC server ...より<micro_service_name> server ...のほうがいいんですかね〜?
Comment on lines
33
to
+35
| if err != nil { | ||
| panic(err) | ||
| log.Printf("failed to get spanner client: %v", err) | ||
| return |
There was a problem hiding this comment.
database.GetSpannerClient 失敗時のハンドリングが log.Printf + return になっており、PR説明の「log.Fatalf に統一」と整合していません。またこのエラーはサーバー起動不能なので、他の起動時エラーと同様にプロセスを終了させる(例: log.Fatalf など)形に揃えるのが安全です。
Comment on lines
66
to
68
| if err := server.Serve(listener); err != nil { | ||
| panic(err) | ||
| log.Fatalf("failed to serve gRPC server: %v", err) | ||
| } |
There was a problem hiding this comment.
server.Serve は GracefulStop() / Stop() 呼び出し時に grpc.ErrServerStopped を返すため、通常のシャットダウンでもここが log.Fatalf で異常終了し得ます。errors.Is(err, grpc.ErrServerStopped)(必要なら net.ErrClosed も)を除外して、想定外のエラーだけを fatal にしてください。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WHAT
server.GracefulStop()にタイムアウト(10秒)を追加し、タイムアウト時はserver.Stop()にフォールバックするように変更panic/log.Fatallnが混在していたエラーハンドリングをlog.Fatalfに統一log.Fatalln後の到達不能なreturn文を削除WHY
GracefulStop()はタイムアウトがないため、長時間リクエストがあるとサーバーが永久に停止できなくなるpanic/log.Fatalln/log.Fatalln+ 到達不能なreturnとバラバラで一貫性がなかったNOTE: This is a demo PR for fude.nvim.