Skip to content

Commit 73cf9e3

Browse files
committed
[slowlog parser] exceeding maxTraceLen must not reset parser state
1 parent ff9d098 commit 73cf9e3

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pkg/phpfpm/slowlog_parser.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ func (slp *SlowlogParser) parseStacktraceEntry(line []byte, entry *SlowlogEntry)
7676
return err
7777
}
7878

79+
if slp.maxTraceLen > 0 && len(entry.Stacktrace) >= slp.maxTraceLen {
80+
return nil
81+
}
82+
7983
entry.Stacktrace = append(entry.Stacktrace, SlowlogTraceEntry{
8084
PtrHex: string(line[matches[2]:matches[3]]),
8185
FunName: string(line[matches[4]:matches[5]]),
@@ -112,10 +116,6 @@ func (slp *SlowlogParser) parseLine(line []byte, entry *SlowlogEntry, state *int
112116
*state = stateParseHeader
113117
break
114118
}
115-
116-
if slp.maxTraceLen > 0 && len(entry.Stacktrace) >= slp.maxTraceLen {
117-
return true
118-
}
119119
default:
120120
panic("unexpected state")
121121
}

0 commit comments

Comments
 (0)