This sentence appears to follow the rules described above. There is a comma before the conjunction (but), and the nonessential comment (in the end) is set off with a pair of commas. There was a time when this sentence would be punctuated exactly this way. Today, such a sentence is considered over-punctuated.