mirror of
https://git.pleroma.social/pleroma/relay.git
synced 2024-11-22 06:27:59 +00:00
optimize RelayDatabase.get_inbox
This commit is contained in:
parent
9369b598fa
commit
4ea6a040fb
|
@ -120,14 +120,14 @@ class RelayDatabase(dict):
|
||||||
if domain.startswith('http'):
|
if domain.startswith('http'):
|
||||||
domain = urlparse(domain).hostname
|
domain = urlparse(domain).hostname
|
||||||
|
|
||||||
if domain not in self['relay-list']:
|
inbox = self['relay-list'].get(domain)
|
||||||
|
|
||||||
|
if inbox:
|
||||||
|
return inbox
|
||||||
|
|
||||||
if fail:
|
if fail:
|
||||||
raise KeyError(domain)
|
raise KeyError(domain)
|
||||||
|
|
||||||
return
|
|
||||||
|
|
||||||
return self['relay-list'][domain]
|
|
||||||
|
|
||||||
|
|
||||||
def add_inbox(self, inbox, followid=None, fail=False):
|
def add_inbox(self, inbox, followid=None, fail=False):
|
||||||
assert inbox.startswith('https'), 'Inbox must be a url'
|
assert inbox.startswith('https'), 'Inbox must be a url'
|
||||||
|
|
Loading…
Reference in a new issue