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:
2026-05-22 15:30:28 +07:00
parent a422913972
commit db8ee9c49b
3 changed files with 7 additions and 3 deletions
+4
View File
@@ -91,6 +91,10 @@
{
"command": "trade_stats",
"description": "Show portfolio summary with P&L"
},
{
"command": "stats",
"description": "Show command usage statistics"
}
]
}
+3 -1
View File
@@ -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
-2
View File
@@ -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