From 7b8102b4f06e57ba124e4b443841f26328b6c378 Mon Sep 17 00:00:00 2001 From: June Date: Fri, 15 Aug 2025 21:48:17 +0200 Subject: [PATCH] avoid waiting on long timeouts for shorter program runtime Avoid waiting on long timeouts by moving from default timeout of 30 seconds to a custom timeout of 5 seconds. --- main.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/main.go b/main.go index ceda106..2b59ee9 100644 --- a/main.go +++ b/main.go @@ -8,6 +8,7 @@ import ( "sort" "strings" "sync" + "time" "github.com/hashicorp/go-version" "github.com/matrix-org/gomatrixserverlib/fclient" @@ -256,6 +257,7 @@ func main() { token := os.Getenv("MATRIX_TOKEN") room := os.Getenv("MATRIX_ROOM") verbose := false + timeoutSeconds := 5 client, err := mautrix.NewClient( homeserver, @@ -267,6 +269,7 @@ func main() { } federationClient := fclient.NewClient( fclient.WithWellKnownSRVLookups(true), + fclient.WithTimeout(time.Second*time.Duration(timeoutSeconds)), ) joinedMembers, err := client.JoinedMembers(context.Background(), id.RoomID(room))