Make hay while the sun shines.
Meaning: Make the most of favorable conditions till they last.
Example: I got plenty of referral traffic to my website from Facebook in its initial years. I made hay while the sun shone. Later on they changed their algorithm, after which the traffic dried.