The word in hebrew for to complain is להתלונן which has within it the root of the word ללון ,to sleep overnight, to lodge.
A possible lesson in the connection could be that when all one does is complain ,justified or not you are stuck,lodged where you are not moving forward.
When one is stuck eventually if one does not go forward one regresses.
However if any complaining is accompanied or replaced by positive ,effective actions and reactions then at most we are stuck ,we sleep overnight and then get moving forward with the beautiful gift of life that Hashem has given us