The function is not reliable with low sample size, but in this case a good estimate can be found by simulations.
To avoid a fused sentence, we place a comma before a coordinating conjunction.
Usually, we also set off parenthetical phrases with bracketing commas.
This example is made complicated by the presence of these two requirements, and we have to adjust our comma placement to comply with the stricter of the two rules.
This ensures a smoother sentence.
According to
http://www.sussex.ac.uk/informatics/punctuation/comma/bracketing
In many cases a weak interruption does not absolutely require bracketing commas.
The phrase 'in this case' in the example is a weak interruption, and we could omit the bracketing comma pair for it.
Your example is fine.