mirror of
https://github.com/0ceanSlim/grain.git
synced 2024-11-22 00:27:14 +00:00
move apply resource limits to config package
This commit is contained in:
parent
6737718f08
commit
4e218c292a
@ -1,4 +1,4 @@
|
|||||||
package utils
|
package config
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
2
main.go
2
main.go
@ -39,7 +39,7 @@ func main() {
|
|||||||
log.Fatal("Error loading config: ", err)
|
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)
|
client, err := db.InitDB(cfg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -16,7 +16,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func HandleEvent(ws *websocket.Conn, message []interface{}) {
|
func HandleEvent(ws *websocket.Conn, message []interface{}) {
|
||||||
utils.LimitedGoRoutine(func() {
|
config.LimitedGoRoutine(func() {
|
||||||
if len(message) != 2 {
|
if len(message) != 2 {
|
||||||
fmt.Println("Invalid EVENT message format")
|
fmt.Println("Invalid EVENT message format")
|
||||||
response.SendNotice(ws, "", "Invalid EVENT message format")
|
response.SendNotice(ws, "", "Invalid EVENT message format")
|
||||||
|
@ -17,7 +17,7 @@ var subscriptions = make(map[string]relay.Subscription)
|
|||||||
var mu sync.Mutex // Protect concurrent access to subscriptions map
|
var mu sync.Mutex // Protect concurrent access to subscriptions map
|
||||||
|
|
||||||
func HandleReq(ws *websocket.Conn, message []interface{}, subscriptions map[string][]relay.Filter) {
|
func HandleReq(ws *websocket.Conn, message []interface{}, subscriptions map[string][]relay.Filter) {
|
||||||
utils.LimitedGoRoutine(func() {
|
config.LimitedGoRoutine(func() {
|
||||||
if len(message) < 3 {
|
if len(message) < 3 {
|
||||||
fmt.Println("Invalid REQ message format")
|
fmt.Println("Invalid REQ message format")
|
||||||
response.SendClosed(ws, "", "invalid: invalid REQ message format")
|
response.SendClosed(ws, "", "invalid: invalid REQ message format")
|
||||||
|
Loading…
Reference in New Issue
Block a user