Explorar el Código

Merge pull request #940 from Alkarex/PshbErrorManagement

PubSubHubbub prevent subscribing too often in case of error
Alexandre Alapetite hace 10 años
padre
commit
43c35b72ea
Se han modificado 1 ficheros con 8 adiciones y 1 borrados
  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;
 	}