Hardcode agent stale timeout

This commit is contained in:
Brandon Zhang
2026-03-27 18:32:25 +08:00
parent 07e31ce215
commit c690d0c483
15 changed files with 14 additions and 92 deletions

View File

@@ -30,7 +30,6 @@ func (s *SettingsStore) Get() (models.Settings, error) {
cfg := models.Settings{
DefaultWaitSeconds: 10,
DefaultEmptyResponse: config.DefaultEmptyResponse,
AgentStaleAfterSeconds: 30,
}
for rows.Next() {
@@ -43,10 +42,6 @@ func (s *SettingsStore) Get() (models.Settings, error) {
if n, err := strconv.Atoi(value); err == nil {
cfg.DefaultWaitSeconds = n
}
case "agent_stale_after_seconds":
if n, err := strconv.Atoi(value); err == nil {
cfg.AgentStaleAfterSeconds = n
}
}
}
return cfg, rows.Err()
@@ -57,10 +52,8 @@ func (s *SettingsStore) Get() (models.Settings, error) {
func (s *SettingsStore) Update(patch models.Settings) error {
_, err := s.db.Exec(`
INSERT OR REPLACE INTO settings (key, value) VALUES
('default_wait_seconds', ?),
('agent_stale_after_seconds', ?)`,
('default_wait_seconds', ?)` ,
strconv.Itoa(patch.DefaultWaitSeconds),
strconv.Itoa(patch.AgentStaleAfterSeconds),
)
return err
}