Merge pull request #769 from safing/fix/microtasks
Use new microtask functions
This commit is contained in:
3
broadcasts/testdata/README.md
vendored
3
broadcasts/testdata/README.md
vendored
@@ -1,6 +1,9 @@
|
||||
# Testing Broadcast Notifications
|
||||
|
||||
```
|
||||
# View matching data
|
||||
curl http://127.0.0.1:817/api/v1/broadcasts/matching-data
|
||||
|
||||
# Reset state
|
||||
curl -X POST http://127.0.0.1:817/api/v1/broadcasts/reset-state
|
||||
|
||||
|
||||
46
broadcasts/testdata/notifications.yaml
vendored
46
broadcasts/testdata/notifications.yaml
vendored
@@ -1,22 +1,26 @@
|
||||
notifications:
|
||||
test1:
|
||||
title: "[TEST] Normal Broadcast"
|
||||
message: "This is a normal broadcast without matching. (#1)"
|
||||
test2:
|
||||
title: "[TEST] Permanent Broadcast"
|
||||
message: "This is a permanent broadcast without matching. (#2)"
|
||||
type: 1 # Warning
|
||||
permanent: true
|
||||
test3:
|
||||
title: "[TEST] Repeating Broadcast"
|
||||
message: "This is a repeating broadcast without matching. (#3)"
|
||||
repeat: "1m"
|
||||
test4:
|
||||
title: "[TEST] Matching Broadcast: PM version"
|
||||
message: "This is a normal broadcast that matches the PM version. (#4)"
|
||||
match: "NumericVersion > 8000"
|
||||
test5:
|
||||
title: "[TEST] Important Update"
|
||||
message: "A criticial update has been released, please update immediately. (#5)"
|
||||
type: 3 # Error
|
||||
attachToModule: true
|
||||
# test1:
|
||||
# title: "[TEST] Normal Broadcast"
|
||||
# message: "This is a normal broadcast without matching. (#1)"
|
||||
# test2:
|
||||
# title: "[TEST] Permanent Broadcast"
|
||||
# message: "This is a permanent broadcast without matching. (#2)"
|
||||
# type: 1 # Warning
|
||||
# permanent: true
|
||||
# test3:
|
||||
# title: "[TEST] Repeating Broadcast"
|
||||
# message: "This is a repeating broadcast without matching. (#3)"
|
||||
# repeat: "1m"
|
||||
# test4:
|
||||
# title: "[TEST] Matching Broadcast: PM version"
|
||||
# message: "This is a normal broadcast that matches the PM version. (#4)"
|
||||
# match: "NumericVersion > 8000"
|
||||
# test5:
|
||||
# title: "[TEST] Important Update"
|
||||
# message: "A criticial update has been released, please update immediately. (#5)"
|
||||
# type: 3 # Error
|
||||
# attachToModule: true
|
||||
new-network-monitor-feedback:
|
||||
title: "New: Full-Device Network Activity"
|
||||
message: "We re-imagined the network monitor to bring you better search and graphs. Thanks for being a Beta Tester! We would love to hear your feedback on [Twitter](https://twitter.com/SafingIO), [Reddit](https://www.reddit.com/r/safing), [GitHub](https://github.com/safing/portmaster-ui/issues/new/choose) or [via Email](mailto:support@safing.io)."
|
||||
match: "Version sameas 0.9.0 and Updates.Channel sameas beta"
|
||||
|
||||
4
go.mod
4
go.mod
@@ -14,7 +14,7 @@ require (
|
||||
github.com/hashicorp/go-version v1.6.0
|
||||
github.com/miekg/dns v1.1.50
|
||||
github.com/oschwald/maxminddb-golang v1.9.0
|
||||
github.com/safing/portbase v0.14.6
|
||||
github.com/safing/portbase v0.15.0
|
||||
github.com/safing/spn v0.4.13
|
||||
github.com/shirou/gopsutil v3.21.11+incompatible
|
||||
github.com/spf13/cobra v1.5.0
|
||||
@@ -29,7 +29,7 @@ require (
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/VictoriaMetrics/metrics v1.18.1 // indirect
|
||||
github.com/VictoriaMetrics/metrics v1.20.1 // indirect
|
||||
github.com/aead/ecdh v0.2.0 // indirect
|
||||
github.com/aead/serpent v0.0.0-20160714141033-fba169763ea6 // indirect
|
||||
github.com/armon/go-radix v1.0.0 // indirect
|
||||
|
||||
4
go.sum
4
go.sum
@@ -130,6 +130,8 @@ github.com/VictoriaMetrics/metrics v1.15.2/go.mod h1:Z1tSfPfngDn12bTfZSCqArT3OPY
|
||||
github.com/VictoriaMetrics/metrics v1.18.0/go.mod h1:ArjwVz7WpgpegX/JpB0zpNF2h2232kErkEnzH1sxMmA=
|
||||
github.com/VictoriaMetrics/metrics v1.18.1 h1:OZ0+kTTto8oPfHnVAnTOoyl0XlRhRkoQrD2n2cOuRw0=
|
||||
github.com/VictoriaMetrics/metrics v1.18.1/go.mod h1:ArjwVz7WpgpegX/JpB0zpNF2h2232kErkEnzH1sxMmA=
|
||||
github.com/VictoriaMetrics/metrics v1.20.1 h1:XqQbRKYzwkmo0DKKDbvp6V7upUqErlqd0vXPoeBsEbU=
|
||||
github.com/VictoriaMetrics/metrics v1.20.1/go.mod h1:ArjwVz7WpgpegX/JpB0zpNF2h2232kErkEnzH1sxMmA=
|
||||
github.com/acomagu/bufpipe v1.0.3/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4=
|
||||
github.com/aead/ecdh v0.2.0 h1:pYop54xVaq/CEREFEcukHRZfTdjiWvYIsZDXXrBapQQ=
|
||||
github.com/aead/ecdh v0.2.0/go.mod h1:a9HHtXuSo8J1Js1MwLQx2mBhkXMT6YwUmVVEY4tTB8U=
|
||||
@@ -833,6 +835,8 @@ github.com/safing/portbase v0.14.5 h1:+8H+mQ7AFjA04M7UPq0490pj3/+nvJj3pEUP1PYTMY
|
||||
github.com/safing/portbase v0.14.5/go.mod h1:z9sRR/vqohAGdYSSx2B+o8tND4WVvcxPL6XBBtN3bDI=
|
||||
github.com/safing/portbase v0.14.6 h1:AKj1TVJmqOrjXXWcPetchQhHVBwfD3/QDvgmkUj2FxY=
|
||||
github.com/safing/portbase v0.14.6/go.mod h1:hC6KV9oZsD7yuAom42L5wgOEZ0yAjr2i1r2F5duBSA8=
|
||||
github.com/safing/portbase v0.15.0 h1:WwJpnERbNfzqDkEHt39l1TbBhnvf/oB2ZKj6fkaMSTM=
|
||||
github.com/safing/portbase v0.15.0/go.mod h1:BinbSUlbOdsHTBSE8+WkKbR1bXNMlsbhhAW12EBxsUo=
|
||||
github.com/safing/portmaster v0.7.3/go.mod h1:o//kZ8eE+5vT1V22mgnxHIAdlEz42sArsK5OF2Lf/+s=
|
||||
github.com/safing/portmaster v0.7.4/go.mod h1:Q93BWdF1oAL0oUMukshl8W1aPZhmrlTGi6tFTFc3pTw=
|
||||
github.com/safing/portmaster v0.7.6/go.mod h1:qOs9hQtvAzTVICRbwLg3vddqOaqJHeWBjWQ0C+TJ/Bw=
|
||||
|
||||
@@ -40,8 +40,7 @@ func connectionCleaner(ctx context.Context) error {
|
||||
func cleanConnections() (activePIDs map[int]struct{}) {
|
||||
activePIDs = make(map[int]struct{})
|
||||
|
||||
name := "clean connections" // TODO: change to new fn
|
||||
_ = module.RunMediumPriorityMicroTask(&name, func(ctx context.Context) error {
|
||||
_ = module.RunMicroTask("clean connections", 0, func(ctx context.Context) error {
|
||||
now := time.Now().UTC()
|
||||
nowUnix := now.Unix()
|
||||
deleteOlderThan := now.Add(-DeleteConnsAfterEndedThreshold).Unix()
|
||||
|
||||
Reference in New Issue
Block a user