From 6e6e6482ccae6272388fc4207d7becc730250c0b Mon Sep 17 00:00:00 2001 From: Peter Nemere Date: Thu, 5 Dec 2024 06:01:25 +1000 Subject: [PATCH] Added disk free space reporting in lambda, it might have filled up due to several fails in a row, where it doesn't clear working dir --- internal/lambdas/data-import/main.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/internal/lambdas/data-import/main.go b/internal/lambdas/data-import/main.go index fe488803..00213b61 100644 --- a/internal/lambdas/data-import/main.go +++ b/internal/lambdas/data-import/main.go @@ -30,6 +30,7 @@ import ( "github.com/pixlise/core/v4/core/fileaccess" "github.com/pixlise/core/v4/core/logger" "github.com/pixlise/core/v4/core/mongoDBConnection" + "github.com/pixlise/core/v4/core/utils" ) func HandleRequest(ctx context.Context, event awsutil.Event) (string, error) { @@ -80,6 +81,13 @@ func HandleRequest(ctx context.Context, event awsutil.Event) (string, error) { // and it'll be useful for initial debugging fmt.Printf("ImportForTrigger: \"%v\"\n", record.SNS.Message) + freeBytes, err := utils.GetDiskAvailableBytes() + if err != nil { + fmt.Printf("Failed to read disk free space: %v\n", err) + } else { + fmt.Printf("Disk free space: %v\n", freeBytes) + } + mongoClient, _, err := mongoDBConnection.Connect(sess, mongoSecret, iLog) if err != nil { log.Fatal(err)