The flag way should work, Here's code I use in one of my projects to acheiveachieve what you're trying to.
class Vendor_Modulename_Model_Observer
{
public $eventComplete = false;
function sales_quote_collect_totals_after()
{
if($this->eventComplete){return;}
$this->eventComplete = true;
// put module code below here
}
}