Skip to content

Commit

Permalink
*: address comments for 2nd round
Browse files Browse the repository at this point in the history
Signed-off-by: BornChanger <[email protected]>
  • Loading branch information
BornChanger committed Oct 27, 2023
1 parent 12c9fe8 commit 613654e
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions br/pkg/aws/ebs.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,12 +291,10 @@ func (e *EC2Session) EnableDataFSR(meta *config.EBSBasedBRMeta, targetAZ string)

eg, _ := errgroup.WithContext(context.Background())

workerPool := utils.NewWorkerPool(uint(len(snapshotsIDsMap)), "enable snapshot FSR")

for availableZone := range snapshotsIDsMap {
targetAZ := availableZone
workerPool.ApplyOnErrorGroup(eg, func() error {
log.Info("enable fsr for snapshots", zap.String("available zone", availableZone))
eg.Go(func() error {
log.Info("enable fsr for snapshots", zap.String("available zone", targetAZ))
resp, err := e.ec2.EnableFastSnapshotRestores(&ec2.EnableFastSnapshotRestoresInput{
AvailabilityZones: []*string{&targetAZ},
SourceSnapshotIds: snapshotsIDsMap[targetAZ],
Expand Down Expand Up @@ -379,11 +377,9 @@ func (e *EC2Session) DisableDataFSR(snapshotsIDsMap map[string][]*string) error

eg, _ := errgroup.WithContext(context.Background())

workerPool := utils.NewWorkerPool(uint(len(snapshotsIDsMap)), "disable snapshot FSR")

for availableZone := range snapshotsIDsMap {
targetAZ := availableZone
workerPool.ApplyOnErrorGroup(eg, func() error {
eg.Go(func() error {
resp, err := e.ec2.DisableFastSnapshotRestores(&ec2.DisableFastSnapshotRestoresInput{
AvailabilityZones: []*string{&targetAZ},
SourceSnapshotIds: snapshotsIDsMap[targetAZ],
Expand Down

0 comments on commit 613654e

Please sign in to comment.