Skip to content

Commit e5da03b

Browse files
committed
Cosmetics
1 parent c142e22 commit e5da03b

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

filter/lua.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,12 @@ type LUA struct {
129129
mu sync.Mutex
130130
l *lua.LState // lua state used during all the baker filter lifetime
131131

132-
luaFunc lua.LValue // lua filter function
133-
recordMt lua.LValue
132+
// These do not need protection against concurrent calls as they're strictly
133+
// read-only.
134+
luaProcess lua.LValue // lua filter function
135+
recordMt lua.LValue // lua record type meta table
134136

135-
nprocessed, nfiltered int64
137+
nprocessed, nfiltered int64 // for filter stats
136138
}
137139

138140
// NewLUA returns a new LUA filter.
@@ -152,9 +154,9 @@ func NewLUA(cfg baker.FilterParams) (baker.Filter, error) {
152154
}
153155

154156
f := &LUA{
155-
l: l,
156-
recordMt: l.GetTypeMetatable(luaRecordTypeName),
157-
luaFunc: luaFunc,
157+
l: l,
158+
recordMt: l.GetTypeMetatable(luaRecordTypeName),
159+
luaProcess: luaFunc,
158160
}
159161

160162
// Since a filter has no way to know when it's deallocated we set a
@@ -240,7 +242,7 @@ func (t *LUA) Process(rec baker.Record, next func(baker.Record)) {
240242
ud.Value = &luaRecord{r: rec}
241243

242244
err := t.l.CallByParam(lua.P{
243-
Fn: t.luaFunc,
245+
Fn: t.luaProcess,
244246
NRet: 0,
245247
Protect: true,
246248
}, ud, luaNext)

0 commit comments

Comments
 (0)