fix: use MESH_HOST_HEARTBEAT_TTL_SECONDS environment variable#37
Merged
takaokouji merged 2 commits intomainfrom Jan 4, 2026
Merged
fix: use MESH_HOST_HEARTBEAT_TTL_SECONDS environment variable#37takaokouji merged 2 commits intomainfrom
takaokouji merged 2 commits intomainfrom
Conversation
- Replaced hardcoded 60s with MESH_HOST_HEARTBEAT_TTL_SECONDS in: - checkGroupExists (validation threshold) - listGroupsByDomain (filtering threshold) - createGroup/createGroupIfNotExists (initial TTL) - Added TTL filtering to listNodesInGroup and listGroupStatuses - Added TTL to node status items in reportDataByNode - Updated findNodeMetadata to exclude expired nodes - Fixed inconsistent heartbeatIntervalSeconds default value in createGroupIfNotExists Co-Authored-By: Gemini <noreply@google.com>
…time - MESH_HOST_HEARTBEAT_INTERVAL_SECONDS: 30 -> 60 (production/default) - MESH_MAX_CONNECTION_TIME_SECONDS: 3000 -> 1500 (production/default) - MESH_MAX_CONNECTION_TIME_SECONDS: 600 -> 300 (development default in CDK) - Updated documentation and AppSync resolvers/functions to match these new defaults. Co-Authored-By: Gemini <noreply@google.com>
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.
Summary
This PR fixes an issue where the environment variable was ignored in several critical parts of the AppSync resolvers, often falling back to a hardcoded 60-second value. This caused groups to expire prematurely in production where the heartbeat interval is also 60 seconds.
Changes
Verification
DynamoDBRepository
#dissolve_group
handles items with multibyte characters correctly
#find_group
handles multibyte characters in keys and attributes
CreateDomainUseCase
#execute
ソースIPをCRC32でハッシュ化して16進数で返す
source_ipがnilの場合は 'none' を使用してハッシュ化する
異なるIPからは異なるドメインが生成される
CreateGroupUseCase
#execute
既存グループが存在しない場合
新しいグループを作成する
グループIDが自動生成される
既存グループが存在する場合
既存グループを返す(冪等性)
同じhostId + domainで複数回呼び出しても同じグループを返す
DissolveGroupUseCase
#execute
正常系
ホストがグループを解散できる
異常系
グループIDが空の場合エラー
ドメインが空の場合エラー
ホストIDが空の場合エラー
グループが存在しない場合エラー
ホストでないノードが解散を試みた場合エラー
べき等性
既に解散されたグループを解散しようとした場合はエラー(グループ不存在)
LeaveGroupUseCase
#execute
ピアがグループから正常に退出する場合
ピアをグループから削除し、データも削除する
成功メッセージを返す
ピアの削除に失敗した場合
失敗の結果を返す
ピアのデータ削除に失敗した場合
失敗の結果を返す
複数のピアが連続して退出する場合
各ピアを独立して処理する
Finished in 0.02825 seconds (files took 0.49589 seconds to load)
30 examples, 0 failures.