Not a bad suggestion. Hereās a different point of view for consideration: avoid using pub.flow:clearPipeline. Instead, always explicitly drop vars as soon as they are no longer needed.
Here are some thoughts on this from posts many moons ago that may be informative:
(The last one refers to a notion of the pipeline being ācopied over from services to servicesā but it is not ā the pipeline is a global variable pool for the thread and all services run in that thread have access to the pipeline ā with exceptions for services invoked as transformers or within a scope.)
Edit: A couple of the threads referenced above mention ābest practicesā ā there is no such thing. Just practices that some find useful for their environment. You may find they work for you as well.