This commit is contained in:
parent
a4988c6716
commit
6413d80c64
@ -9,6 +9,6 @@ on:
|
||||
jobs:
|
||||
Lint:
|
||||
runs-on: [hubstaging]
|
||||
uses: http://gitea.pena/PenaDevops/actions.git/.gitea/workflows/lint.yml@v1.1.0
|
||||
uses: http://gitea.pena/PenaDevops/actions.git/.gitea/workflows/lint.yml@v1.1.1
|
||||
with:
|
||||
runner: hubstaging
|
||||
|
@ -3,8 +3,8 @@ version: "3"
|
||||
tasks:
|
||||
update-linter:
|
||||
cmds:
|
||||
- go get -u gitea.pena/PenaSide/linters-golang.git
|
||||
- go get -u gitea.pena/PenaSide/linters-golang
|
||||
lint:
|
||||
cmds:
|
||||
- task: update-linter
|
||||
- cmd: golangci-lint run -v -c $(go list -f '{{"{{"}}.Dir{{"}}"}}' -m gitea.pena/PenaSide/linters-golang.git)/.golangci.yml
|
||||
- cmd: golangci-lint run -v -c $(go list -f '{{"{{"}}.Dir{{"}}"}}' -m gitea.pena/PenaSide/linters-golang)/.golangci.yml
|
||||
|
2
go.mod
2
go.mod
@ -3,7 +3,7 @@ module gitea.pena/PenaSide/trashlog
|
||||
go 1.22.0
|
||||
|
||||
require (
|
||||
gitea.pena/PenaSide/linters-golang.git v0.0.0-20241107123845-60e4981764af
|
||||
gitea.pena/PenaSide/linters-golang v0.0.0-20241114215743-9a8e7d58cf96
|
||||
github.com/ClickHouse/clickhouse-go v1.5.4
|
||||
github.com/onsi/ginkgo v1.16.0
|
||||
github.com/onsi/gomega v1.11.0
|
||||
|
4
go.sum
4
go.sum
@ -1,7 +1,7 @@
|
||||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
gitea.pena/PenaSide/linters-golang.git v0.0.0-20241107123845-60e4981764af h1:g9U+JXUI9daAZbSw+uW+5tlEdkejdRUwbJxu6FMHi24=
|
||||
gitea.pena/PenaSide/linters-golang.git v0.0.0-20241107123845-60e4981764af/go.mod h1:KOzb6hT9ASsvA6RB41GoQIwRhFr/U+f8jx3fnQsknXk=
|
||||
gitea.pena/PenaSide/linters-golang v0.0.0-20241114215743-9a8e7d58cf96 h1:m4EMXEhsA/glI6eJeZnRGUhYPSQdcWj3hzT2IDNlWS0=
|
||||
gitea.pena/PenaSide/linters-golang v0.0.0-20241114215743-9a8e7d58cf96/go.mod h1:gdd+vOT6up9STkEbxa2qESLIMZFjCmRbkcheFQCVgZU=
|
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
github.com/ClickHouse/clickhouse-go v1.5.4 h1:cKjXeYLNWVJIx2J1K6H2CqyRmfwVJVY1OV1coaaFcI0=
|
||||
github.com/ClickHouse/clickhouse-go v1.5.4/go.mod h1:EaI/sW7Azgz9UATzd5ZdZHRUhHgv5+JMS9NSr2smCJI=
|
||||
|
2
main.go
2
main.go
@ -3,7 +3,7 @@ package main
|
||||
import (
|
||||
"github.com/skeris/appInit"
|
||||
"gitea.pena/PenaSide/trashlog/app"
|
||||
_ "gitea.pena/PenaSide/linters-golang.git/pkg/dummy"
|
||||
_ "gitea.pena/PenaSide/linters-golang/pkg/dummy"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
@ -31,7 +31,7 @@ type TrashLogCore struct {
|
||||
keyFields map[string]*pb.Value
|
||||
recoverStore *bbolt.DAL
|
||||
url string
|
||||
SendMutex sync.Mutex
|
||||
SendMutex *sync.Mutex
|
||||
failCh chan bool
|
||||
emitCh chan entryWithFields
|
||||
connected bool
|
||||
@ -71,7 +71,7 @@ func NewCore(
|
||||
url: url,
|
||||
ctxFields: make(map[string]*pb.Value),
|
||||
keyFields: make(map[string]*pb.Value),
|
||||
SendMutex: sync.Mutex{},
|
||||
SendMutex: &sync.Mutex{},
|
||||
failCh: make(chan bool),
|
||||
emitCh: make(chan entryWithFields, 100),
|
||||
connected: false,
|
||||
@ -212,7 +212,7 @@ func (c *TrashLogCore) With(fields []zapcore.Field) zapcore.Core {
|
||||
stream: c.stream,
|
||||
recoverStore: c.recoverStore,
|
||||
url: c.url,
|
||||
SendMutex: sync.Mutex{}, // вот тут
|
||||
SendMutex: c.SendMutex,
|
||||
failCh: c.failCh,
|
||||
emitCh: c.emitCh,
|
||||
}
|
||||
@ -252,7 +252,7 @@ func (c *TrashLogCore) Write(
|
||||
) error {
|
||||
fmt.Println("Write()")
|
||||
c.SendMutex.Lock()
|
||||
//defer c.SendMutex.Unlock()
|
||||
defer c.SendMutex.Unlock()
|
||||
c.saveFields(entry, fields)
|
||||
fmt.Println("Write()end")
|
||||
|
||||
|
@ -232,14 +232,14 @@ func TestSendMutex(t *testing.T) {
|
||||
}))
|
||||
|
||||
loggerHlog1 := hlog.New(loggerForHlog1).Module("loggerForHlog1")
|
||||
loggerHlog1.With(InfoLogger1{})
|
||||
llooggerZap := loggerHlog1.With(InfoLogger1{})
|
||||
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(1)
|
||||
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
loggerHlog1.Emit(InfoTest{Test: "test"}) // мьютекс лочим
|
||||
llooggerZap.Emit(InfoTest{Test: "test"}) // мьютекс лочим
|
||||
}()
|
||||
|
||||
time.Sleep(1 * time.Second)
|
||||
|
Loading…
Reference in New Issue
Block a user