forked from mirrors/bookwyrm
Safer federation of book data changes
Only broadcast to other BW instances, plus bonus error handling
This commit is contained in:
parent
a63471c56f
commit
c0ccb7065c
2 changed files with 5 additions and 1 deletions
|
@ -449,7 +449,7 @@ def broadcast_task(sender_id, activity, recipients):
|
|||
for recipient in recipients:
|
||||
try:
|
||||
sign_and_send(sender, activity, recipient)
|
||||
except (HTTPError, SSLError) as e:
|
||||
except (HTTPError, SSLError, ConnectionError) as e:
|
||||
logger.exception(e)
|
||||
|
||||
|
||||
|
|
|
@ -37,6 +37,10 @@ class BookDataModel(ObjectMixin, BookWyrmModel):
|
|||
self.remote_id = None
|
||||
return super().save(*args, **kwargs)
|
||||
|
||||
def broadcast(self, activity, sender, software='bookwyrm'):
|
||||
''' only send book data updates to other bookwyrm instances '''
|
||||
super().broadcast(activity, sender, software=software)
|
||||
|
||||
|
||||
class Book(BookDataModel):
|
||||
''' a generic book, which can mean either an edition or a work '''
|
||||
|
|
Loading…
Reference in a new issue