mirror of
https://github.com/tiennm99/miti99bot.git
synced 2026-06-08 04:17:16 +00:00
fix(stats): unblock deploy and register /stats in Telegram command menu
- Remove ReservedConcurrentExecutions: 1 (account lacks unreserved concurrency headroom; deploy rolled back). Accept best-effort counter semantics as documented. - Add /stats to aws/telegram-commands.json so it appears in the Telegram client's / autocomplete after the next deploy.
This commit is contained in:
@@ -91,6 +91,10 @@
|
||||
{
|
||||
"command": "trade_stats",
|
||||
"description": "Show portfolio summary with P&L"
|
||||
},
|
||||
{
|
||||
"command": "stats",
|
||||
"description": "Show command usage statistics"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -31,7 +31,9 @@ type counter struct {
|
||||
func countKey(name string) string { return countPrefix + name }
|
||||
|
||||
// Inc increments the persistent invocation count for the named command.
|
||||
// Errors are logged and swallowed — stats are best-effort.
|
||||
// Errors are logged and swallowed and concurrent invocations of the same
|
||||
// command may lose updates — stats are best-effort. A future atomic
|
||||
// increment (e.g. DynamoDB UpdateItem ADD) would close the race.
|
||||
func (c *counter) Inc(ctx context.Context, name string) {
|
||||
key := countKey(name)
|
||||
var entry countEntry
|
||||
|
||||
@@ -135,8 +135,6 @@ Resources:
|
||||
TELEGRAM_WEBHOOK_SECRET_PARAMETER_NAME: !Sub "/miti99bot/${StackEnv}/telegram-webhook-secret"
|
||||
GEMINI_API_KEY_PARAMETER_NAME: !Sub "/miti99bot/${StackEnv}/gemini-api-key"
|
||||
CRON_SHARED_SECRET_PARAMETER_NAME: !Sub "/miti99bot/${StackEnv}/cron-shared-secret"
|
||||
# stats module uses non-atomic KV increment; concurrency > 1 would lose counts.
|
||||
ReservedConcurrentExecutions: 1
|
||||
FunctionUrlConfig:
|
||||
AuthType: NONE
|
||||
InvokeMode: BUFFERED
|
||||
|
||||
Reference in New Issue
Block a user