@@ -134,11 +134,7 @@ func (r *Local) Backup(info BackupInfo) error {
134134 defer outfile .Close ()
135135 global .LOG .Infof ("start to pg_dump | gzip > %s.gzip" , info .TargetDir + "/" + info .FileName )
136136
137- ctx , cancel := context .WithTimeout (context .Background (), time .Duration (info .Timeout * uint (time .Second )))
138- defer cancel ()
139- cmd := exec .CommandContext (
140- ctx ,
141- "docker" , "exec" , "-i" , r .ContainerName ,
137+ cmd := exec .Command ("docker" , "exec" , "-i" , r .ContainerName ,
142138 "sh" , "-c" ,
143139 fmt .Sprintf ("PGPASSWORD=%s pg_dump -F c -U %s -d %s" , r .Password , r .Username , info .Name ),
144140 )
@@ -161,9 +157,7 @@ func (r *Local) Recover(info RecoverInfo) error {
161157 fi , _ := os .Open (info .SourceFile )
162158 defer fi .Close ()
163159
164- ctx , cancel := context .WithTimeout (context .Background (), time .Duration (info .Timeout * uint (time .Second )))
165- defer cancel ()
166- cmd := exec .CommandContext (ctx , "docker" , "exec" , "-i" , r .ContainerName , "sh" , "-c" ,
160+ cmd := exec .Command ("docker" , "exec" , "-i" , r .ContainerName , "sh" , "-c" ,
167161 fmt .Sprintf ("PGPASSWORD=%s pg_restore -F c -c --if-exists --no-owner -U %s -d %s" , r .Password , r .Username , info .Name ),
168162 )
169163 if strings .HasSuffix (info .SourceFile , ".gz" ) {
0 commit comments