Pin the search in demo mode

Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com>
This commit is contained in:
Hadi
2026-04-10 23:38:27 +02:00
parent 3b75d945c4
commit f30c386fbf
3 changed files with 6 additions and 0 deletions

View File

@@ -21,6 +21,7 @@ func (m *Manager) InjectDemoSearches() {
InputType: tools.InputTypeEmail,
Profile: "default",
StartedAt: now.Add(-2 * time.Hour),
pinned: true,
PlannedTools: []ToolStatus{
{Name: "user-scanner", ResultCount: ptr(10)},
{Name: "github-recon", ResultCount: ptr(3)},
@@ -77,6 +78,7 @@ func (m *Manager) InjectDemoSearches() {
InputType: tools.InputTypeUsername,
Profile: "default",
StartedAt: now.Add(-30 * time.Minute),
pinned: true,
PlannedTools: []ToolStatus{
{Name: "user-scanner", ResultCount: ptr(10)},
{Name: "github-recon", ResultCount: ptr(0)},

View File

@@ -131,6 +131,9 @@ func (m *Manager) purgeExpired() {
m.mu.Lock()
defer m.mu.Unlock()
for id, s := range m.searches {
if s.pinned {
continue // demo/pinned searches are never purged
}
ft := s.FinishedAt()
if ft.IsZero() {
continue // still running

View File

@@ -32,6 +32,7 @@ type Search struct {
PlannedTools []ToolStatus
cancelFn context.CancelFunc
pinned bool // if true, never purged by the cleanup loop
mu sync.RWMutex
events []tools.Event