From 810e75a34dddd88279bea1cd2ea38816fe872d52 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Sun, 1 Mar 2020 13:08:32 +0100 Subject: Very primitive ability to send fb messages --- connector/connector.go | 2 +- connector/external/external.go | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'connector') diff --git a/connector/connector.go b/connector/connector.go index 210d4ad..48fc9e7 100644 --- a/connector/connector.go +++ b/connector/connector.go @@ -130,7 +130,7 @@ type Event struct { Room RoomID `json:"room"` // Message text or action text - Text string `json:"text` + Text string `json:"text"` // Attached files such as images Attachments []SMediaObject `json:"attachments"` diff --git a/connector/external/external.go b/connector/external/external.go index 26f3c40..741802c 100644 --- a/connector/external/external.go +++ b/connector/external/external.go @@ -162,7 +162,7 @@ func (ext *External) setupProc() error { } func (ext *External) restartLoop(generation int) { - for { + for i := 0; i < 2; i++ { if ext.proc == nil { break } @@ -178,6 +178,7 @@ func (ext *External) restartLoop(generation int) { break } } + log.Warnf("More than 3 attempts (%s); abandonning.", ext.command) } func (m *extMessageWithData) UnmarshalJSON(jj []byte) error { @@ -294,7 +295,7 @@ func (ext *External) cmd(msg extMessage, data interface{}) (*extMessageWithData, } else { return rep, nil } - case <-time.After(5 * time.Second): + case <-time.After(30 * time.Second): return nil, fmt.Errorf("(%s) timeout", msg.MsgType) } } @@ -379,7 +380,7 @@ func (ext *External) Join(room RoomID) error { func (ext *External) Invite(user UserID, room RoomID) error { _, err := ext.cmd(extMessage{ - MsgType: LEAVE, + MsgType: INVITE, User: user, Room: room, }, nil) -- cgit v1.2.3