News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Wrote new actions, only one of them works at a time

Started by themavesite, September 25, 2017, 11:25:34 AM

Previous topic - Next topic

themavesite

Open the following three links in random order

http://forums.themavesite.com/index.php?action=recent_cars;start=0
http://forums.themavesite.com/index.php?action=recent_rooms;start=0
http://forums.themavesite.com/index.php?action=recent_oldschool;start=0

You will see that only one of them will effectively load posts, the others won't load, not even after refreshing.

Close the tabs and wait +1min. Now you can open another link that didn't open before, but the other two now won't open...!

I found out that whenever I clear the file cache in admin center, I can immediately load another one of these links. (no 1min waiting time)

What on earth can be causing this??
TMS Forums
Since 2008 and still going strong! Join today! http://forums.themavesite.com/index.php

Illori

what code have you written to generate those pages?

themavesite

#2
Quote from: Illori on September 25, 2017, 11:27:31 AM
what code have you written to generate those pages?
The code is pretty much the basic recent.php but with some small modifications on the sql query (show only posts from one specific topic)

It's as if the code does a php sleep for 1min (which it doesn't of course)
TMS Forums
Since 2008 and still going strong! Join today! http://forums.themavesite.com/index.php

Arantor

Except for the fact that the results of the first one are cached and all of them pull from the same cache because that won't have been changed in the code, which is why copy pasting from existing SMF without understanding what it is doing is a really, really bad idea.

themavesite

Quote from: Arantor on September 25, 2017, 12:00:29 PM
Except for the fact that the results of the first one are cached and all of them pull from the same cache because that won't have been changed in the code, which is why copy pasting from existing SMF without understanding what it is doing is a really, really bad idea.
Just wondering why you always have to be so hostile?
You could've just replied saying I needed to change the $key variable..
My guess is you're just trying to keep people from breaking their forum, which I appreciate, but I'm a big boy and I never change something without a backup and documentation.
Do I understand everything in the code? No, but I'm extremely careful and like learning new stuff along the way.
TMS Forums
Since 2008 and still going strong! Join today! http://forums.themavesite.com/index.php

Arantor

Because I was typing it while at work trying to be helpful and doing it while waiting for some stuff to be pushed to a repo, so I figured I'd spend 30 seconds pointing at roughly the right answer.

And the fact that I've seen thousands of people tinker with things, break them in ways that almost no-one understands how to fix later, all for changes that will almost certainly achieve nothing other than slowing down the forum for actual users when bots hammer the pages.

But sure, let's go with hostile rather than blunt and trying to discourage you from doing things that will likely be counterproductive in the long run.

themavesite

Quote from: Arantor on September 25, 2017, 02:25:16 PM
Because I was typing it while at work trying to be helpful and doing it while waiting for some stuff to be pushed to a repo, so I figured I'd spend 30 seconds pointing at roughly the right answer.

And the fact that I've seen thousands of people tinker with things, break them in ways that almost no-one understands how to fix later, all for changes that will almost certainly achieve nothing other than slowing down the forum for actual users when bots hammer the pages.

But sure, let's go with hostile rather than blunt and trying to discourage you from doing things that will likely be counterproductive in the long run.
You're right, blunt would have been a better way to put it. My apologies.
You're also not wrong at all about your reasoning. But again I'm careful and I really wanted to create this feature on my forum somehow. If robots start slowing down the forum I guess I'll have to disable this again..
Thanks again for pointing out what the original problem was.
TMS Forums
Since 2008 and still going strong! Join today! http://forums.themavesite.com/index.php

Advertisement: