Was that such a bad lesson ?
Sounds like you made money (but upset because you could have made more ??)
If every covered call position spikes up, kudos to you.. You will never go broke taking profits regardless of what you could have made had you held the position longer.
You can always buy a CC back and sell the same strike further out and squeeze a little bit more.
The key with options is to not be greedy and worry about anything other than staying profitable!