changeset 5996:524db6237b48

AbandonedPages macro: check user agent to reduce load caused by bots
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 09 Jun 2013 16:35:56 +0200
parents 2beb3bd18d53
children 6de72050e1b9
files MoinMoin/macro/AbandonedPages.py docs/CHANGES
diffstat 2 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/macro/AbandonedPages.py	Sat Jun 08 23:16:08 2013 +0200
+++ b/MoinMoin/macro/AbandonedPages.py	Sun Jun 09 16:35:56 2013 +0200
@@ -13,5 +13,7 @@
 from MoinMoin.macro import RecentChanges
 
 def macro_AbandonedPages(macro):
+    if macro.request.isSpiderAgent: # reduce bot cpu usage
+        return ''
     return RecentChanges.macro_RecentChanges(macro, abandoned=True)
 
--- a/docs/CHANGES	Sat Jun 08 23:16:08 2013 +0200
+++ b/docs/CHANGES	Sun Jun 09 16:35:56 2013 +0200
@@ -63,7 +63,7 @@
 
     # logged-in users get the backlink, anon users/bots get simple text:
     backlink_method = lambda cfg, req: 'backlink' if req.user.valid else 'text'
-
+  * AbandonedPages macro: check user agent to reduce load caused by bots
 
   Fixes:
   * do not create empty pagedirs (with empty edit-log). To clean up all the