Learn when you can't code anymore.
Learn when you can't process things anymore.
Don't push beyond that, it will just make things worse in the future.
I tried to keep coding once when I had a migraine (not strong, but not mild). Next day, when I was better, I had to rewrite most of the stuff I did, 'cause it was all shit.
Also, when you're not feeling fine, you won't be able to concentrate and your productivity will plunge. It's a lot better to be a burden to society at your own place than a burden to society at work.