There is a growing body of research which suggests that's willpower may be a limited resource. Regardless of how much discipline you have, it appears that having to use it at least temporarily reduces your available willpower. Having to make more decisions earlier in the day apparently depletes your ability to make quality decisions later in the day. This appears to be the reason some influential people, such Steve Jobs or Barack Obama would always wear nearly the same outfits. Judges also appear to be making less favorable decisions the longer it has been since they've had a break.
Knowing this, there are some decisions we can make ahead of time that reduce our susceptibility to decision fatigue, or willpower depletion. Taking breaks, and reducing the amount of decisions one has to make earlier in the day also help.
Our whole day we have to fight distractions that try to prevent us from getting what we need done. Whether it's email, the desire to do your online banking or shopping during work hours, a flood of notifications coming from your phone or computer, or your co-workers asking for your help. The easiest and most surefire way of resisting these is to eliminate as many of them automatically before they even get to you. Turn off the email client on your computer or phone, and set aside one or more specific times of day when you manually check them. Ensure your browser isn't sending you notifications from your favorite sites throughout the day. Turn off notifications on your phone, except for the bare minimum required for your work or home life.
Further, block sites that you should avoid on your browser, and make other browser as inaccessible as possible. Or purchase an app such as focus (https://heyfocus.com) to block it on all browsers.
Whenever you are tempted to open a non-work related site, stop yourself and count down from 5, and pretend your boss is standing right behind you. If it helps to pretend you have to ship your browser history to someone at the end of the day, do that as well. Even if your work requires you to wait for something, such as the completion of a test suite, you're better off staring at the screen, or getting up to get a coffee, than breaking your work flow and randomly browsing the web. It may be easier to go cold turkey this way than starting to read something on a site that you may wish to complete later.
The reward for this is a much more productive day and more time concentrating on the problem at hand. It allows you to push past your discomfort and solve problems you may otherwise be tempted to ignore or only superficially address. Over the course of many weeks, months and years, the result is accelerated learning instead of slow stagnation. Even if your employer doesn't recognize your increased productivity, over time you will become much more skilled and in demand by other employees, and more capable of selling your services to the highest bidder. Regardless if it doesn't affect the ability to get the current job done since you may be blocked by forces outside your control, for your own personal and professional growth, it is better to attempt to do a related work task, or to do some learning related to your field.