Skip to content

Commit

Permalink
Merge pull request #370 from pixlise/bugfix/lambda-disk-space
Browse files Browse the repository at this point in the history
Added disk free space reporting in lambda, it might have filled up du…
  • Loading branch information
pnemere authored Dec 4, 2024
2 parents a30a9d2 + 6e6e648 commit c47c307
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions internal/lambdas/data-import/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit c47c307

Please sign in to comment.