parallelize remote import batches
@@ -225,7 +225,13 @@ func (i *Index) putObjectBatch(ctx context.Context,
byShard[shardName] = group
}
+ wg := &sync.WaitGroup{}
+
for shardName, group := range byShard {
+ wg.Add(1)
+ go func(shardName string, group objsAndPos) {
+ defer wg.Done()
+
local := i.getSchema.
ShardingState(i.Config.ClassName.String()).
IsShardLocal(shardName)
@@ -241,8 +247,11 @@ func (i *Index) putObjectBatch(ctx context.Context,
desiredPos := group.pos[i]
out[desiredPos] = err
}
+ }(shardName, group)
}
+ wg.Wait()
+
return out
}
