split wrap_persistent_handler into helper functions
split wrap_persistent_handler into helper functions

Summary:
in the next diff, i will create a non-Lwt version of `wrap_persistent_handler`, and I want to reuse as much as possible.

Changelog: [internal]

Reviewed By: samwgoldman

Differential Revision: D32731449

fbshipit-source-id: 5ad6e61fa0516d8cbe90fb1808dcf96c2de3f33b

facebook/flow,mroch/flow,facebook/flow,mroch/flow,mroch/flow,mroch/flow,facebook/flow,mroch/flow,mroch/flow,facebook/flow,mroch/flow,facebook/flow,facebook/flow,facebook/flow