You have a “schoolmaster” in learning to persevere in turning to God, in trusting God. God gave you this “schoolmaster”.
The “schoolmaster” is your desires. Now, desires want satisfaction. and there are two ways to satisfy them, or so it seems. First, you go and take care of it yourself. Second, you tell someone else of your desire, then let it go, knowing the “someone else” will provide for you.
The second way is what God wants you to learn when you experience desire (sexual, companionship, etc.). He wants you simply to tell him, “I am hungry”, then go on with your stomach growling to do the works he has put in front of you to do (after all, he is your “Lord”, and you, then, are his “subject” by implication), so your whole life is to come when he says come, go when he says go, and eat when he says, “take and eat”. So, you tell him “I desire”, then you go about his business joyfully, knowing he knows your desire.
The first way, getting it yourself, happens this way. When you desire, your own mind begins thinking of scenarios that could or would lead to successful satisfaction of your desire. You visualize images, have imagined conversations, etc. This is a kind of “pre-thinking” that is an automatic occurrence in the human animal. St. James described it as being “lured and enticed” in the moment of his desire. Then, when the “pre-thinking” has been “conceived”, at some moment you begin to physically act out the pre-thinking. James’s solution: Stop the pre-thinking when you realize it is happening and recall to your thoughts that “every good and perfect gift is from above, coming down from the Father of lights”. That is the source of the satisfaction in your desire. He gave you your desire to make you grow strong in trusting him and turning to him. This “pre-thinking” St Paul called “the Flesh’s Forethought”. “Put on, clothe yourself, with the Lord Jesus Christ - don’t do the pre-thinking (forethought) of the flesh in the midst of desires.” (my translation, from the Greek). Your “schoolmaster”, the desires God gave you are for “testing” you, a proving ground in making you “steadfast, perfect, and complete” in persevering in trusting in Him.
The pre-thinking we do in our heads is not real; the satisfaction is not satisfaction. Look at yourself - in the thoughts you have, you imagine everything is, in a way, “good”, but after, you are fully dis-satisfied with yourself. The pre-thinking, the imaginations, etc. were an illusion, and their satisfaction also vanished like an illusion. When God provides your companion and for the other desires, you will humbly smile and whisper or shout “thank you” to Him. Put away the thoughts. Put on the Prayer. And then do the deeds your Lord sets in front of you as his “lifesoldier”