Generally, I get out if I can book about 80-90% of the profit, however in certain situations I may get out earlier. It really depends on the trade.
I presume you got hit by earnings. In this case, unless I actually wanted to be in a position during the announcement, I would've closed out...