move apply resource limits to config package

This commit is contained in:
0ceanSlim 2024-09-05 11:01:24 -04:00
parent 6737718f08
commit 4e218c292a
4 changed files with 4 additions and 4 deletions

View File

@ -1,4 +1,4 @@
package utils
package config
import (
"log"

View File

@ -39,7 +39,7 @@ func main() {
log.Fatal("Error loading config: ", err)
}
utils.ApplyResourceLimits(&cfg.ResourceLimits) // Apply limits once before starting the server
config.ApplyResourceLimits(&cfg.ResourceLimits) // Apply limits once before starting the server
client, err := db.InitDB(cfg)
if err != nil {

View File

@ -16,7 +16,7 @@ import (
)
func HandleEvent(ws *websocket.Conn, message []interface{}) {
utils.LimitedGoRoutine(func() {
config.LimitedGoRoutine(func() {
if len(message) != 2 {
fmt.Println("Invalid EVENT message format")
response.SendNotice(ws, "", "Invalid EVENT message format")

View File

@ -17,7 +17,7 @@ var subscriptions = make(map[string]relay.Subscription)
var mu sync.Mutex // Protect concurrent access to subscriptions map
func HandleReq(ws *websocket.Conn, message []interface{}, subscriptions map[string][]relay.Filter) {
utils.LimitedGoRoutine(func() {
config.LimitedGoRoutine(func() {
if len(message) < 3 {
fmt.Println("Invalid REQ message format")
response.SendClosed(ws, "", "invalid: invalid REQ message format")