Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
61a50ee6f0 | ||
|
|
4246e37384 |
No files matched your search
+19
-1
@@ -227,7 +227,25 @@ func (s *Server) agentJobs(c *gin.Context) {
|
||||
internalError(c, err)
|
||||
return
|
||||
}
|
||||
jobs, orgs, err := s.resolveJobs(ctx, agentOf(c), entries)
|
||||
agent := agentOf(c)
|
||||
if len(entries) > 0 {
|
||||
// The long poll may have waited for a while: settings such as
|
||||
// allow_private apply to the jobs as they are now.
|
||||
err := s.db.Tx(ctx, tenant.System(), func(q *store.Queries) error {
|
||||
var err error
|
||||
agent, err = q.GetAgentByHash(ctx, HashToken(bearerToken(c)))
|
||||
return err
|
||||
})
|
||||
if errors.Is(err, pgx.ErrNoRows) {
|
||||
fail(c, http.StatusUnauthorized, "unauthenticated")
|
||||
return
|
||||
}
|
||||
if err != nil {
|
||||
internalError(c, err)
|
||||
return
|
||||
}
|
||||
}
|
||||
jobs, orgs, err := s.resolveJobs(ctx, agent, entries)
|
||||
if err != nil {
|
||||
internalError(c, err)
|
||||
return
|
||||
|
||||
@@ -85,7 +85,9 @@ func TestCheckerNetwork(t *testing.T) {
|
||||
}
|
||||
waitResult := func(id string, ok bool, what string) {
|
||||
t.Helper()
|
||||
waitFor(t, 20*time.Second, what, func() bool {
|
||||
// Two runs at most: the one already handed out, then the next on
|
||||
// the monitor's phase, up to one and a half intervals later.
|
||||
waitFor(t, 30*time.Second, what, func() bool {
|
||||
got, msg, seen := latestOf(owner, id)
|
||||
return seen && got == ok && (ok || strings.Contains(msg, "non-public"))
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user