Browse Source

PubSubHubbub prevent subscribing too often in case of error

https://github.com/FreshRSS/FreshRSS/issues/939
Alexandre Alapetite 10 years ago
parent
commit
9e43937f8c
1 changed files with 8 additions and 1 deletions
  1. 8 1
      app/Models/Feed.php

+ 8 - 1
app/Models/Feed.php

@@ -475,7 +475,14 @@ class FreshRSS_Feed extends Minz_Model {
 				file_put_contents($hubFilename, json_encode($hubJson));
 			}
 
-			return substr($info['http_code'], 0, 1) == '2';
+			if (substr($info['http_code'], 0, 1) == '2') {
+				return true;
+			} else {
+				$hubJson['lease_start'] = time();	//Prevent trying again too soon
+				$hubJson['error'] = true;
+				file_put_contents($hubFilename, json_encode($hubJson));
+				return false;
+			}
 		}
 		return false;
 	}