Browse Source

Fix workerId check

Leszek Wiesner 3 years ago
parent
commit
86d79554ed

+ 0 - 1
distributor-node/src/api-spec/public.yml

@@ -191,7 +191,6 @@ components:
           properties:
             bucketIds:
               type: array
-              minItems: 1
               items:
                 type: integer
                 minimum: 0

+ 1 - 1
distributor-node/src/services/httpApi/controllers/public.ts

@@ -296,7 +296,7 @@ export class PublicApiController {
       .json(
         this.config.buckets
           ? { bucketIds: [...this.config.buckets] }
-          : this.config.workerId
+          : typeof this.config.workerId === 'number'
           ? { allByWorkerId: this.config.workerId }
           : { bucketIds: [] }
       )

+ 2 - 2
distributor-node/src/services/networking/NetworkingService.ts

@@ -137,7 +137,7 @@ export class NetworkingService {
       exists = true
       if (!this.config.buckets) {
         const distributors = this.getDataObjectActiveDistributorsSet(details)
-        isSupported = this.config.workerId ? distributors.has(this.config.workerId) : false
+        isSupported = typeof this.config.workerId === 'number' ? distributors.has(this.config.workerId) : false
       } else {
         const supportedBucketIds = this.config.buckets.map((id) => id.toString())
         isSupported = details.storageBag.distirbutionAssignments.some((a) =>
@@ -360,7 +360,7 @@ export class NetworkingService {
   async fetchSupportedDataObjects(): Promise<Map<string, DataObjectData>> {
     const data = this.config.buckets
       ? await this.queryNodeApi.getDistributionBucketsWithObjectsByIds(this.config.buckets.map((id) => id.toString()))
-      : this.config.workerId
+      : typeof this.config.workerId === 'number'
       ? await this.queryNodeApi.getDistributionBucketsWithObjectsByWorkerId(this.config.workerId)
       : []
     const objectsData = new Map<string, DataObjectData>()