mirror of
https://gitea.com/gitea/tea.git
synced 2026-10-26 19:11:25 +01:00
fix: address verified review findings (pulls-1)
Signed-off-by: bircni <bircni@icloud.com>
This commit is contained in:
15 files changed
+202
-8
No files matched your search
@@ -124,6 +124,7 @@ func (s Pulls) WatchChecks(ctx context.Context, n int64, interval time.Duration,
|
||||
return nil, errors.New("check polling interval must be positive")
|
||||
}
|
||||
var previous []Check
|
||||
reported := false
|
||||
for {
|
||||
sha, err := s.checkHead(ctx, n)
|
||||
if err != nil {
|
||||
@@ -133,7 +134,9 @@ func (s Pulls) WatchChecks(ctx context.Context, n int64, interval time.Duration,
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !slices.Equal(items, previous) {
|
||||
// The first poll is reported even when empty, so a watcher can say it is waiting.
|
||||
if !reported || !slices.Equal(items, previous) {
|
||||
reported = true
|
||||
if changed != nil {
|
||||
if err := changed(items); err != nil {
|
||||
return nil, err
|
||||
|
||||
Reference in new issue
Block a user