Skip to content

Commit

Permalink
Merge branch 'main' into adr-for-deployment-slots
Browse files Browse the repository at this point in the history
  • Loading branch information
somesylvie committed Sep 4, 2024
2 parents 49a942e + 5c6cc50 commit a2bbd8f
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 8 deletions.
8 changes: 4 additions & 4 deletions azure_functions/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion azure_functions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@azure/storage-queue": "12.23.0"
},
"devDependencies": {
"@types/node": "20.16.3",
"@types/node": "20.16.4",
"rimraf": "6.0.1",
"typescript": "5.5.4"
},
Expand Down
2 changes: 1 addition & 1 deletion operations/template/logs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ resource "azurerm_log_analytics_query_pack" "application_logs_pack" {
}
}

resource "azurerm_log_analytics_query_pack_query" "example" {
resource "azurerm_log_analytics_query_pack_query" "structured_application_logs" {
display_name = "RS SFTP's Raw Application Logs"
description = "View all RS SFTP's application logs in a structured format"

Expand Down
20 changes: 18 additions & 2 deletions src/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"log/slog"
"net/http"
"os"
"time"
)

func main() {
Expand All @@ -17,6 +18,19 @@ func main() {

go setupHealthCheck()

setUpQueues()

// This loop keeps the app alive. This lets the pre-live deployment slot remain healthy
// even though it's configured without queues, which means we can quickly swap slots
// if needed without having to redeploy
for {
t := time.Now()
slog.Info(t.Format("2006-01-02T15:04:05Z07:00"))
time.Sleep(10 * time.Minute)
}
}

func setUpQueues() {
// Set up the polling message handler and queue listener
pollingMessageHandler := orchestration.PollingMessageHandler{}

Expand All @@ -40,8 +54,10 @@ func main() {
slog.Warn("Failed to create importQueueHandler", slog.Any(utils.ErrorKey, err))
return
}
// This ListenToQueue is not split into a separate Go Routine since it is the core driver of the application
importQueueHandler.ListenToQueue()

go func() {
importQueueHandler.ListenToQueue()
}()
}

func setupLogging() {
Expand Down

0 comments on commit a2bbd8f

Please sign in to comment.