dp.cx blog

Posted on

Filed under work, and ajax

I was recently working a defect at $job to disable submissions of empty "dates" saving to MySQL as epoch -1, when I noticed in my network panel was polling an ajax endpoint, once per second. This poll was happening so that an on screen clock could be displayed showing the time where a potential lead lived.

Needless to say, this is sloppy. Polling a PHP endpoint to convert the time every second is ridiculous. If nothing else, just provide the offset of time between the two, and calculate it in Javascript every time.

When I asked in our public chat, I got no response. git blame immediately showed me who was responsible, but I didn't want to confront them directly, because this individual already thinks I hate them. But at least own up to code that you wrote, and use it as a learning experience of what not to do in the future.