aboutsummaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorTill <2353100+S7evinK@users.noreply.github.com>2023-01-23 13:17:15 +0100
committerGitHub <noreply@github.com>2023-01-23 13:17:15 +0100
commit48fa869fa3578741d1d5775d30f24f6b097ab995 (patch)
treeadaf9b174493a30fec8aeb26cea18f7b42ac9db1 /internal
parent430932f0f161dd836c98082ff97b57beedec02e6 (diff)
Use `t.TempDir` for SQLite databases, so tests don't rip out each others databases (#2950)
This should hopefully finally fix issues about `disk I/O error` as seen [here](https://gitlab.alpinelinux.org/alpine/aports/-/jobs/955030/raw) Hopefully this will also fix `SSL accept attempt failed` issues by disabling HTTP keep alives when generating a config for CI.
Diffstat (limited to 'internal')
-rw-r--r--internal/log.go2
-rw-r--r--internal/log_unix.go2
2 files changed, 4 insertions, 0 deletions
diff --git a/internal/log.go b/internal/log.go
index d7e852c8..da6e2041 100644
--- a/internal/log.go
+++ b/internal/log.go
@@ -24,6 +24,7 @@ import (
"path/filepath"
"runtime"
"strings"
+ "sync"
"github.com/matrix-org/util"
@@ -37,6 +38,7 @@ import (
// this unfortunately results in us adding the same hook multiple times.
// This map ensures we only ever add one level hook.
var stdLevelLogAdded = make(map[logrus.Level]bool)
+var levelLogAddedMu = &sync.Mutex{}
type utcFormatter struct {
logrus.Formatter
diff --git a/internal/log_unix.go b/internal/log_unix.go
index b38e7c2e..8f34c320 100644
--- a/internal/log_unix.go
+++ b/internal/log_unix.go
@@ -85,6 +85,8 @@ func checkSyslogHookParams(params map[string]interface{}) {
}
func setupStdLogHook(level logrus.Level) {
+ levelLogAddedMu.Lock()
+ defer levelLogAddedMu.Unlock()
if stdLevelLogAdded[level] {
return
}