diff --git a/README.md b/README.md index 98a04c6..f40f576 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,7 @@ jobs: **Parameters:** | Parameter | Type | Description | Required | | :--- | :---: | :--- | :---: | -| initial_mapping | `string` | a [Bloblang mapping](https://www.benthos.dev/docs/guides/bloblang/about) that can be used to customize the initial version returned by this resource, defaults to `id = ksuid()` | | +| initial_mapping | `string` | a [Bloblang mapping](https://www.benthos.dev/docs/guides/bloblang/about) that can be used to customize the initial version returned by this resource, if not specified, checking is a noop and should be disabled via `check_every: never` | | ## Behavior diff --git a/main.go b/main.go index caa651e..777dcb5 100644 --- a/main.go +++ b/main.go @@ -59,18 +59,15 @@ type Resource struct{} // Check is a required resource method, but is a no-op for this resource func (r *Resource) Check(ctx context.Context, s *Source, v *Version) (versions []Version, err error) { - if v == nil { - m := "id = ksuid()" - if s != nil && s.InitialMapping != "" { - m = s.InitialMapping - } - init, _, err := r.newVersion(ctx, m) + if v != nil { + versions = append(versions, *v) + } + if len(versions) == 0 && s.InitialMapping != "" { + init, _, err := r.newVersion(ctx, s.InitialMapping) if err != nil { return nil, err } versions = append(versions, *init) - } else { - versions = append(versions, *v) } return }