Broadcast ignores

This commit is contained in:
Ivan Kozik 2015-07-18 05:55:51 +00:00
parent 09418a905a
commit 14b59e17dc
2 changed files with 17 additions and 3 deletions

View File

@ -52,6 +52,13 @@ class MyServerProtocol(WebSocketServerProtocol):
"job_data": obj["job_data"],
"message": obj["message"]
})
elif type == "ignore":
self.broadcastToDashboards({
"type": type,
"job_data": obj["job_data"],
"url": obj["url"],
"pattern": obj["pattern"],
})
class MyServerFactory(WebSocketServerFactory):

View File

@ -154,8 +154,7 @@ def acceptUrl(urlInfo, recordInfo, verdict, reasons):
pattern = shouldIgnoreURL(url, recordInfo)
if pattern:
if not os.path.exists(os.path.join(workingDir, "igoff")):
printToReal("IGNOR %s by %s" % (url, pattern))
maybeLogIgnore(url, pattern)
return False
# If we get here, none of our ignores apply. Return the original verdict.
@ -190,7 +189,15 @@ def handleError(urlInfo, recordInfo, errorInfo):
def maybeLogIgnore(url, pattern):
pass
if not os.path.exists(os.path.join(workingDir, "igoff")):
printToReal("IGNOR %s by %s" % (url, pattern))
if wsFactory.client:
wsFactory.client.sendObject({
"type": "ignore",
"job_data": getJobData(),
"url": url,
"pattern": pattern
})
# Regular expressions for server headers go here