Ideally, you don't want the 5000 ohm resistor plug cap there, but I don't think it is the cause of your problem. You could try without it to see - but 3 hours running to find out seems a really very long time! It is worth trying new spark plugs, though, as they are cheap and easy to change.
Normally, if sparks are going to disappear when the magneto gets hot, they will stop after a few miles/ km, say 20 minutes, and the bike may then start again when it has cooled. And stop or splutter again as it gets hot again. That behavious would suggest a faulty condenser or a faulty HT winding, or occasionally a faulty slipring (the bit the carbon brushes (coals) run on inside the magneto) or HT pick-up(s) which leak when hot.
The brushes should move freely in the pick-up on their springs - a clean with electrical contact cleaning fluid or similar would solve that probably. If they were stuck solid, though, I'd expect any fault to show up much sooner than 3 hours!
It is also always worth checking the state of the contact breaker and the points gap - but again, three hours is a long time for it to run before it displays a sudden fault.
If the machine had been left standing for a long time, it is more than likely that the condenser has deteriorated, and / or that the HT coil is tired. There are various tests you can do to check that the HT coil is continuous, but no easy test for the condenser.
As a very basic test, you should be able to get a 5 or 6mm spark to jump from the end of the HT lead (plug cap removed) to earth, at kickstart speed, hot or cold. If it won't do that, then further investigation is needed. If the magneto is off the bike, then you should be able to get 5-6mm sparks off it at the rate of just less than 2 per second, turning it steadily.
The thing with these things is that although they are extremely reliable and can work for many years with no attention to speak of, once they start behaving erratically it is often necessary to carry out a full range of tests to work out what's good and what isn't. It's possible, yes, to play a bit, get it to work for a while, then have more trouble . . . until you are going round in circles.
If the magneto is 'as original' it may well need a proper overhaul, to be perfectly honest.