Ensure only one refresh is running for a user/resource at a time (#5054)

This ensures we don't have competing update processes running. When doing the
inline RefreshForSearch, a specific error will be returned so we can hint in
the API that we're in the middle of a refresh.

(cherry picked from commit 54776091e32af2f2f110f2bf10d0617bd5677aba)
This commit is contained in:
Jeff Mitchell authored and Timothy Messier committed 2024-09-24 14:18:53 +00:00
1 parent b04de5ac4b
commit 829ea02e6f
6 files changed
+371 -26

No files matched your search

@@ -140,7 +140,9 @@ func TestSearch(t *testing.T) {
assert.Nil(t, apiErr)
assert.NotNil(t, resp)
assert.NotNil(t, r)
assert.EqualValues(t, r, &daemon.SearchResult{})
assert.EqualValues(t, r, &daemon.SearchResult{
RefreshStatus: daemon.NotRefreshing,
})
})
t.Run("empty response from query", func(t *testing.T) {
@@ -154,7 +156,9 @@ func TestSearch(t *testing.T) {
assert.Nil(t, apiErr)
assert.NotNil(t, resp)
assert.NotNil(t, r)
assert.EqualValues(t, r, &daemon.SearchResult{})
assert.EqualValues(t, r, &daemon.SearchResult{
RefreshStatus: daemon.NotRefreshing,
})
})
t.Run("unsupported boundary instance", func(t *testing.T) {