# Nakama-js can be timeout when pipeline.ProcessRequest return false

**URL:** <https://forum.heroiclabs.com/t/nakama-js-can-be-timeout-when-pipeline-processrequest-return-false/4945>\
**Category:** Runtime Framework\
**Tags:** server-framework\
**Created:** [February 2, 2024, 6:44am UTC](https://forum.heroiclabs.com/t/nakama-js-can-be-timeout-when-pipeline-processrequest-return-false/4945 "2024-02-02T06:44:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nguyentrannhan](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/nguyentrannhan/32/2057_2.png) [@nguyentrannhan](https://forum.heroiclabs.com/u/nguyentrannhan)\
**Post date:** [February 2, 2024, 6:44am UTC](https://forum.heroiclabs.com/t/nakama-js-can-be-timeout-when-pipeline-processrequest-return-false/4945/1 "2024-02-02T06:44:00Z")

</div>

When pipeline.ProcessRequest return false, the nakama-js can be timeout because the IncommingLoop is break. To fix it, we add a flag for safely break the IncommingLoop

```auto
diff --git a/server/session_ws.go b/server/session_ws.go
index b5a9222e..f37eacb1 100644
--- a/server/session_ws.go
+++ b/server/session_ws.go
@@ -171,6 +171,8 @@ func (s *sessionWS) Expiry() int64 {
 }
 
 func (s *sessionWS) Consume() {
+	var IsSafeBreakLoop bool = false
+
 	// Fire an event for session start.
 	if fn := s.runtime.EventSessionStart(); fn != nil {
 		fn(s.userID.String(), s.username.Load(), s.vars, s.expiry, s.id.String(), s.clientIP, s.clientPort, s.lang, time.Now().UTC().Unix())
@@ -241,17 +243,21 @@ IncomingLoop:
 			break
 		}
 
+ if IsSafeBreakLoop {
+ break IncomingLoop
+ }
+
 		switch request.Cid {
 		case "":
 			if !s.pipeline.ProcessRequest(s.logger, s, request) {
 				reason = "error processing message"
- break IncomingLoop
+ IsSafeBreakLoop = true
 			}
 		default:
 			requestLogger := s.logger.With(zap.String("cid", request.Cid))
 			if !s.pipeline.ProcessRequest(requestLogger, s, request) {
 				reason = "error processing message"
- break IncomingLoop
+ IsSafeBreakLoop = true
 			}
 		}
 
```
