Skip to content

Commit

Permalink
indexer: run ObtainSchema even if scheduling of an upstream job fails
Browse files Browse the repository at this point in the history
  • Loading branch information
radeksimko committed Aug 10, 2022
1 parent d425b9a commit a2fa3a0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion internal/indexer/walker.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ func (idx *Indexer) WalkedModule(ctx context.Context, modHandle document.DirHand
}

if dataDir.PluginLockFilePath != "" {
dependsOn := make(job.IDs, 0)
pSchemaVerId, err := idx.jobStore.EnqueueJob(job.Job{
Dir: modHandle,
Func: func(ctx context.Context) error {
Expand All @@ -123,6 +124,7 @@ func (idx *Indexer) WalkedModule(ctx context.Context, modHandle document.DirHand
errs = multierror.Append(errs, err)
} else {
ids = append(ids, pSchemaVerId)
dependsOn = append(dependsOn, pSchemaVerId)
refCollectionDeps = append(refCollectionDeps, pSchemaVerId)
}

Expand All @@ -133,7 +135,7 @@ func (idx *Indexer) WalkedModule(ctx context.Context, modHandle document.DirHand
return module.ObtainSchema(ctx, idx.modStore, idx.schemaStore, modHandle.Path())
},
Type: op.OpTypeObtainSchema.String(),
DependsOn: job.IDs{pSchemaVerId},
DependsOn: dependsOn,
})
if err != nil {
errs = multierror.Append(errs, err)
Expand Down
4 changes: 3 additions & 1 deletion internal/indexer/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ func (idx *Indexer) ModuleManifestChanged(ctx context.Context, modHandle documen

func (idx *Indexer) PluginLockChanged(ctx context.Context, modHandle document.DirHandle) (job.IDs, error) {
ids := make(job.IDs, 0)
dependsOn := make(job.IDs, 0)
var errs *multierror.Error

pSchemaVerId, err := idx.jobStore.EnqueueJob(job.Job{
Expand All @@ -49,6 +50,7 @@ func (idx *Indexer) PluginLockChanged(ctx context.Context, modHandle document.Di
errs = multierror.Append(errs, err)
} else {
ids = append(ids, pSchemaVerId)
dependsOn = append(dependsOn, pSchemaVerId)
}

pSchemaId, err := idx.jobStore.EnqueueJob(job.Job{
Expand All @@ -59,7 +61,7 @@ func (idx *Indexer) PluginLockChanged(ctx context.Context, modHandle document.Di
},
IgnoreState: true,
Type: op.OpTypeObtainSchema.String(),
DependsOn: job.IDs{pSchemaVerId},
DependsOn: dependsOn,
})
if err != nil {
errs = multierror.Append(errs, err)
Expand Down

0 comments on commit a2fa3a0

Please sign in to comment.