aboutsummaryrefslogtreecommitdiff
path: root/modules/github/__init__.py
diff options
context:
space:
mode:
authorGravatar jesopo2019-06-16 17:05:40 +0100
committerGravatar jesopo2019-06-16 17:05:40 +0100
commit4b61f837fb3ce4365284675c6c97349e9a963442 (patch)
treea6032acc46fdaae50067d2a23a298bd8949acce9 /modules/github/__init__.py
parentAdd auto-github-timeout to prevent duplicate auto-githubs (diff)
signature
'timeout' -> 'cooldown'. closes #60
Diffstat (limited to 'modules/github/__init__.py')
-rw-r--r--modules/github/__init__.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/modules/github/__init__.py b/modules/github/__init__.py
index c7150478..7f3ff8f7 100644
--- a/modules/github/__init__.py
+++ b/modules/github/__init__.py
@@ -113,7 +113,7 @@ CHECK_RUN_FAILURES = ["failure", "cancelled", "timed_out", "action_required"]
@utils.export("channelset", {"setting": "auto-github",
"help": "Enable/disable automatically getting github issue/PR info",
"validate": utils.bool_or_none, "example": "on"})
-@utils.export("channelset", {"setting": "auto-github-timeout",
+@utils.export("channelset", {"setting": "auto-github-cooldown",
"help": "Set amount of seconds between auto-github duplicates",
"validate": utils.int_or_none, "example": "300"})
class Module(ModuleManager.BaseModule):
@@ -240,12 +240,12 @@ class Module(ModuleManager.BaseModule):
def _cache_ref(self, ref):
return "auto-github-%s" % ref.lower()
- def _auto_github_timeout(self, channel, ref):
- timeout = channel.get_setting("auto-github-timeout", None)
- if not timeout == None:
+ def _auto_github_cooldown(self, channel, ref):
+ cooldown = channel.get_setting("auto-github-cooldown", None)
+ if not cooldown == None:
cache = self._cache_ref(ref)
if not self.bot.cache.has_item(cache):
- self.bot.cache.temporary_cache(cache, timeout)
+ self.bot.cache.temporary_cache(cache, cooldown)
return True
else:
return False
@@ -262,7 +262,7 @@ class Module(ModuleManager.BaseModule):
event.eat()
ref = "%s/%s#%s" % (event["match"].group(1),
event["match"].group(2), event["match"].group(4))
- if self._auto_github_timeout(event["target"], ref):
+ if self._auto_github_cooldown(event["target"], ref):
try:
result = self._get_info(event["target"], ref)
except utils.EventError:
@@ -281,7 +281,7 @@ class Module(ModuleManager.BaseModule):
if event["target"].get_setting("auto-github", False):
event.eat()
ref = event["match"].group(0)
- if self._auto_github_timeout(event["target"], ref):
+ if self._auto_github_cooldown(event["target"], ref):
try:
result = self._get_info(event["target"],
event["match"].group(0))