block/bridge: handle bridge is None on selection
This commit is contained in:
parent
0c4929592a
commit
6cc6aedafc
1 changed files with 2 additions and 2 deletions
|
@ -1,13 +1,11 @@
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
import logging
|
import logging
|
||||||
from abc import abstractmethod
|
from abc import abstractmethod
|
||||||
import fnmatch
|
|
||||||
from typing import Tuple, List, Callable
|
from typing import Tuple, List, Callable
|
||||||
|
|
||||||
from app.extensions import db
|
from app.extensions import db
|
||||||
from app.models.activity import Activity
|
from app.models.activity import Activity
|
||||||
from app.models.bridges import Bridge
|
from app.models.bridges import Bridge
|
||||||
from app.models.mirrors import Proxy
|
|
||||||
from app.terraform import BaseAutomation
|
from app.terraform import BaseAutomation
|
||||||
|
|
||||||
|
|
||||||
|
@ -28,6 +26,8 @@ class BlockBridgeAutomation(BaseAutomation):
|
||||||
rotated = []
|
rotated = []
|
||||||
for id_ in ids:
|
for id_ in ids:
|
||||||
bridge = bridge_select_func(id_)
|
bridge = bridge_select_func(id_)
|
||||||
|
if bridge is None:
|
||||||
|
continue
|
||||||
logging.debug("Found %s blocked", bridge.fingerprint)
|
logging.debug("Found %s blocked", bridge.fingerprint)
|
||||||
if bridge.added > datetime.utcnow() - timedelta(hours=3):
|
if bridge.added > datetime.utcnow() - timedelta(hours=3):
|
||||||
logging.debug("Not rotating a bridge less than 3 hours old")
|
logging.debug("Not rotating a bridge less than 3 hours old")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue