Sentinel: small refactoring of sentinelCollectTerminatedScripts().
Sentinel: small refactoring of sentinelCollectTerminatedScripts().

Related to #7113.

JackieXie168/redis,JackieXie168/redis,JackieXie168/redis,JackieXie168/redis