mirror of
https://github.com/anotherhadi/iknowyou.git
synced 2026-04-12 00:47:26 +02:00
Pin the search in demo mode
Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com>
This commit is contained in:
@@ -21,6 +21,7 @@ func (m *Manager) InjectDemoSearches() {
|
|||||||
InputType: tools.InputTypeEmail,
|
InputType: tools.InputTypeEmail,
|
||||||
Profile: "default",
|
Profile: "default",
|
||||||
StartedAt: now.Add(-2 * time.Hour),
|
StartedAt: now.Add(-2 * time.Hour),
|
||||||
|
pinned: true,
|
||||||
PlannedTools: []ToolStatus{
|
PlannedTools: []ToolStatus{
|
||||||
{Name: "user-scanner", ResultCount: ptr(10)},
|
{Name: "user-scanner", ResultCount: ptr(10)},
|
||||||
{Name: "github-recon", ResultCount: ptr(3)},
|
{Name: "github-recon", ResultCount: ptr(3)},
|
||||||
@@ -77,6 +78,7 @@ func (m *Manager) InjectDemoSearches() {
|
|||||||
InputType: tools.InputTypeUsername,
|
InputType: tools.InputTypeUsername,
|
||||||
Profile: "default",
|
Profile: "default",
|
||||||
StartedAt: now.Add(-30 * time.Minute),
|
StartedAt: now.Add(-30 * time.Minute),
|
||||||
|
pinned: true,
|
||||||
PlannedTools: []ToolStatus{
|
PlannedTools: []ToolStatus{
|
||||||
{Name: "user-scanner", ResultCount: ptr(10)},
|
{Name: "user-scanner", ResultCount: ptr(10)},
|
||||||
{Name: "github-recon", ResultCount: ptr(0)},
|
{Name: "github-recon", ResultCount: ptr(0)},
|
||||||
|
|||||||
@@ -131,6 +131,9 @@ func (m *Manager) purgeExpired() {
|
|||||||
m.mu.Lock()
|
m.mu.Lock()
|
||||||
defer m.mu.Unlock()
|
defer m.mu.Unlock()
|
||||||
for id, s := range m.searches {
|
for id, s := range m.searches {
|
||||||
|
if s.pinned {
|
||||||
|
continue // demo/pinned searches are never purged
|
||||||
|
}
|
||||||
ft := s.FinishedAt()
|
ft := s.FinishedAt()
|
||||||
if ft.IsZero() {
|
if ft.IsZero() {
|
||||||
continue // still running
|
continue // still running
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ type Search struct {
|
|||||||
PlannedTools []ToolStatus
|
PlannedTools []ToolStatus
|
||||||
|
|
||||||
cancelFn context.CancelFunc
|
cancelFn context.CancelFunc
|
||||||
|
pinned bool // if true, never purged by the cleanup loop
|
||||||
|
|
||||||
mu sync.RWMutex
|
mu sync.RWMutex
|
||||||
events []tools.Event
|
events []tools.Event
|
||||||
|
|||||||
Reference in New Issue
Block a user