3
0
mirror of https://kolaente.dev/konrad/docker-db-backup.git synced 2026-01-09 12:40:07 +01:00

fix: don't stop everything when one container could not be backed up

Resolves #3
This commit is contained in:
kolaente
2023-06-15 14:27:29 +02:00
parent bd72e06825
commit 42932f91d2
2 changed files with 5 additions and 9 deletions

View File

@@ -3,6 +3,7 @@ package main
import (
"github.com/docker/docker/api/types"
"github.com/docker/docker/client"
"github.com/google/martian/log"
"strings"
)
@@ -26,18 +27,16 @@ func NewDumperFromContainer(container *types.ContainerJSON) Dumper {
return nil
}
func dumpAllDatabases(c *client.Client) error {
func dumpAllDatabases(c *client.Client) {
lock.Lock()
defer lock.Unlock()
for _, dumper := range store {
for containerID, dumper := range store {
err := dumper.Dump(c)
if err != nil {
return err
log.Errorf("Could not dump database from container %s: %v", containerID, err)
}
}
return nil
}
func getDumpFilename(containerName string) string {

View File

@@ -27,10 +27,7 @@ func main() {
log.Fatalf("Could not clean old backups: %s", err)
}
err = dumpAllDatabases(c)
if err != nil {
log.Fatalf("Could not dump databases: %s", err)
}
dumpAllDatabases(c)
err = callWebhook()
if err != nil {