Skip to content

Commit c6baa12

Browse files
committed
addressed code review
Signed-off-by: Nir Rozenbaum <[email protected]>
1 parent e82fc3e commit c6baa12

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

pkg/epp/plugins/plugin_state_test.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,14 @@ func TestPluginState_ReadWrite(t *testing.T) {
6666
assert.True(t, ok, "should be able to cast to pluginTestData")
6767
assert.Equal(t, data1, td.value)
6868

69-
// Delete the req2 data and verify it's removed
69+
// Delete the req2 data and verify content that was read before is still valid
70+
readData, err = state.Read(req2, key)
71+
assert.NoError(t, err)
7072
state.Delete(req2)
73+
td, ok = readData.(*pluginTestData)
74+
assert.True(t, ok, "should be able to cast to pluginTestData")
75+
assert.Equal(t, data2, td.value)
76+
// try to read again aftet deletion, verify error
7177
readData, err = state.Read(req2, key)
7278
assert.Equal(t, ErrNotFound, err)
7379
assert.Nil(t, readData, "expected no data after delete")

pkg/epp/scheduling/framework/plugins/multi/prefix/plugin.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ func (p *Plugin) PreRequest(ctx context.Context, request *types.LLMRequest, sche
209209
targetPod := primaryProfileResult.TargetPods[0].GetPod() // get the first pod of the primary profile
210210

211211
state, err := plugins.ReadPluginStateKey[*SchedulingContextState](p.pluginState, request.RequestId, PrefixCachePluginType)
212+
p.pluginState.Delete(request.RequestId) // delete the state explicitly after completing using it
212213
if err != nil {
213214
log.FromContext(ctx).Error(err, "failed to read prefix plugin state", "requestID", request.RequestId)
214215
return

0 commit comments

Comments
 (0)