File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff 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 )
You can’t perform that action at this time.
0 commit comments