fix: panic stack without sender, log service error frames, refresh account on reconnect
- handler panic log includes the stack trace and no longer the sender number - error and exception frames from the service are logged at Warn level - Listen looks the account up again after a connection loss (re-link) - document that received but unhandled messages are lost at shutdown Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
788dd0b968
commit
b54aab1534
5 files changed
+162
-3
No files matched your search
@@ -16,6 +16,10 @@ import (
|
||||
)
|
||||
|
||||
// Client talks to a signal-cli-rest-api service. It is safe for concurrent use.
|
||||
//
|
||||
// The linked account is looked up on first use and cached. Listen looks it
|
||||
// up again after each connection loss; create a new Client to make Send and
|
||||
// Groups use a newly linked account.
|
||||
type Client struct {
|
||||
base *url.URL
|
||||
number string
|
||||
@@ -177,6 +181,13 @@ func (c *Client) Accounts(ctx context.Context) ([]Account, error) {
|
||||
return accts, nil
|
||||
}
|
||||
|
||||
// forgetAccount drops the cached account so the next call looks it up again.
|
||||
func (c *Client) forgetAccount() {
|
||||
c.mu.Lock()
|
||||
c.acct = nil
|
||||
c.mu.Unlock()
|
||||
}
|
||||
|
||||
// account resolves the account to use and caches it after the first success.
|
||||
// The lock is not held during the lookup, so each caller's ctx applies; a
|
||||
// concurrent duplicate lookup is harmless.
|
||||
|
||||
Reference in new issue
Block a user