fix(resp): keep the not-applied flag through redisStore under yaegi

Yaegi drops the flag when fmt.Errorf wraps the error, and it has no
errors.As. respNotApplied now checks the top-level type only. The
redisStore wrapper marks its own error when the pipeline error is
marked.
This commit is contained in:
2026-11-26 04:19:48 +00:00
parent 1e07c4b00f
commit 8dc9d15f68
3 changed files with 31 additions and 17 deletions
+4 -12
View File
@@ -357,19 +357,11 @@ func markNotApplied(err error, wrote bool) error {
}
// respNotApplied reports whether err says the failed call never wrote its request.
// It walks Unwrap by hand because errors.As is unsupported under yaegi.
// It checks the top-level type only: under yaegi a fmt.Errorf %w wrapper loses the marker, and errors.As is
// unsupported, so each wrapper that must keep it (redisStore) re-marks its own error.
func respNotApplied(err error) bool {
for err != nil {
if _, ok := err.(*notAppliedError); ok {
return true
}
u, ok := err.(interface{ Unwrap() error })
if !ok {
return false
}
err = u.Unwrap()
}
return false
_, ok := err.(*notAppliedError)
return ok
}
// pipelineMutatingCommands names every RESP command this client ever sends