Russia was in no shape to take on Germany—the treaty gave them time to get ready for the war everyone knew would happen someday. Stalin blew it by not being ready when Hitler attacked. In looking back it was one of the stupidiest things Adolph Hitler did—that and decalring war on the USA (he didn’t need to—his treaty with Japan didn’t say he had to join them in the war with America). These mistakes—Dunkirk, Not building enough Me 262s, delaying the V-2 for a year, Not building an aircraft carrier, Trusting Italy, the Holocaust etc... doomed his war.
The Pact delayed the conflict between Nazi Germany and the Soviet Union by more than a year and a half.