diff --git a/config.json b/config.json index 2b836ab03..fc5b2a644 100644 --- a/config.json +++ b/config.json @@ -21,6 +21,7 @@ "QuestCacheExpiry": 300, "CommandPrefix": "!", "AutoCreateAccount": true, + "LoopDelay": 50, "DefaultCourses": [1, 23, 24], "EarthStatus": 0, "EarthID": 0, diff --git a/config/config.go b/config/config.go index 52642956b..f7c48f88f 100644 --- a/config/config.go +++ b/config/config.go @@ -81,6 +81,7 @@ type Config struct { QuestCacheExpiry int // Number of seconds to keep quest data cached CommandPrefix string // The prefix for commands AutoCreateAccount bool // Automatically create accounts if they don't exist + LoopDelay int // Delay in milliseconds between each loop iteration DefaultCourses []uint16 EarthStatus int32 EarthID int32 diff --git a/server/channelserver/sys_session.go b/server/channelserver/sys_session.go index e091f78f9..86552f611 100644 --- a/server/channelserver/sys_session.go +++ b/server/channelserver/sys_session.go @@ -4,6 +4,7 @@ import ( "encoding/binary" "encoding/hex" "erupe-ce/common/mhfcourse" + _config "erupe-ce/config" "fmt" "io" "net" @@ -169,7 +170,7 @@ func (s *Session) sendLoop() { } buffer = buffer[:0] } - time.Sleep(100 * time.Millisecond) + time.Sleep(time.Duration(_config.ErupeConfig.LoopDelay) * time.Millisecond) } } @@ -194,7 +195,7 @@ func (s *Session) recvLoop() { return } s.handlePacketGroup(pkt) - time.Sleep(100 * time.Millisecond) + time.Sleep(time.Duration(_config.ErupeConfig.LoopDelay) * time.Millisecond) } }