Refresh specific resources before searching when they are stale (#4046)

validate versions for all handlers. Refresh specific user before searching

Pass flags on to the background process

Allow the search refresh timeout to be configured
This commit is contained in:
Todd authored and Johan Brandhorst-Satzkorn committed 2024-01-05 07:43:20 -08:00
1 parent b3d268eae5
commit cdc6fb0973
19 files changed
+543 -100

No files matched your search

+6 -3
View File
@@ -32,6 +32,8 @@ var (
"targets",
"sessions",
}
errDaemonNotRunning = stderrors.New("The deamon process is not running.")
)
type SearchCommand struct {
@@ -165,10 +167,11 @@ func (c *SearchCommand) Search(ctx context.Context) (*api.Response, *daemon.Sear
func search(ctx context.Context, daemonPath string, fb filterBy, opt ...client.Option) (*api.Response, *daemon.SearchResult, *api.Error, error) {
addr, err := daemon.SocketAddress(daemonPath)
if err != nil {
return nil, nil, nil, fmt.Errorf("Error when retrieving the socket address: %w", err)
return nil, nil, nil, fmt.Errorf("Error getting socket address: %w", err)
}
if _, err := os.Stat(addr.Path); addr.Scheme == "unix" && err == os.ErrNotExist {
return nil, nil, nil, fmt.Errorf("Error when detecting if the domain socket is present: %w.", err)
_, err = os.Stat(addr.Path)
if addr.Scheme == "unix" && err != nil {
return nil, nil, nil, errDaemonNotRunning
}
c, err := client.New(ctx, addr)
if err != nil {