fix(convex): mover cron jobs para API HTTP + crontab do Linux
Problema: - Cron jobs do Convex criam registros em _scheduled_job_logs - Convex self-hosted carrega TODAS as versoes em memoria - 1488 execucoes/dia = ~45k registros/mes acumulando - Uso de memoria chegando a 19GB, causando 12 OOM kills/dia Solucao: - Criar endpoints HTTP em /api/cron/* para substituir crons - Desabilitar crons no Convex (comentados em crons.ts) - Chamar endpoints via crontab do Linux Novos arquivos: - src/app/api/cron/chat-cleanup/route.ts - src/app/api/cron/usb-cleanup/route.ts - scripts-static/* (copiado da VPS para versionamento) Documentacao: - docs/OPERATIONS.md secao 12 com instrucoes do crontab 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
e2dde8510a
commit
178c7d7341
10 changed files with 1357 additions and 19 deletions
37
scripts-static/bootstrap.ps1
Normal file
37
scripts-static/bootstrap.ps1
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
#! powershell
|
||||
param(
|
||||
[string]$BaseUrl = "https://scripts.rever.com.br",
|
||||
[string]$WorkDir = "$env:TEMP\\rever-menu",
|
||||
[string]$Profile = "default",
|
||||
[switch]$DryRun
|
||||
)
|
||||
|
||||
Set-StrictMode -Version Latest
|
||||
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 -bor [Net.SecurityProtocolType]::Tls11
|
||||
|
||||
function Download-File {
|
||||
param([string]$Uri, [string]$Destination)
|
||||
Write-Host ("Baixando {0} -> {1}" -f $Uri, $Destination) -ForegroundColor Cyan
|
||||
Invoke-WebRequest -Uri $Uri -OutFile $Destination -UseBasicParsing
|
||||
}
|
||||
|
||||
New-Item -ItemType Directory -Path $WorkDir -Force | Out-Null
|
||||
|
||||
$menuPath = Join-Path $WorkDir "menu.ps1"
|
||||
$catalogPath = Join-Path $WorkDir "comandos.json"
|
||||
|
||||
Download-File -Uri ("{0}/menu.ps1" -f $BaseUrl) -Destination $menuPath
|
||||
Download-File -Uri ("{0}/comandos.json" -f $BaseUrl) -Destination $catalogPath
|
||||
|
||||
try { Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass -Force -ErrorAction Stop } catch { }
|
||||
|
||||
if (-not (Test-Path $menuPath)) {
|
||||
Write-Host "menu.ps1 nao encontrado apos download." -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
|
||||
$menuArgs = @("-Profile", $Profile)
|
||||
if ($DryRun) { $menuArgs += "-DryRun" }
|
||||
|
||||
& $menuPath @menuArgs
|
||||
Loading…
Add table
Add a link
Reference in a new issue