Transaction.
This commit is contained in:
		
							parent
							
								
									71a206a19f
								
							
						
					
					
						commit
						bd5bb5ae65
					
				@ -30,6 +30,7 @@ class NotificationService(BaseService):
 | 
				
			|||||||
            uid=channel_message_uid
 | 
					            uid=channel_message_uid
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
        user = await self.services.user.get(uid=channel_message["user_uid"])
 | 
					        user = await self.services.user.get(uid=channel_message["user_uid"])
 | 
				
			||||||
 | 
					        self.app.db.begin()
 | 
				
			||||||
        async for channel_member in self.services.channel_member.find(
 | 
					        async for channel_member in self.services.channel_member.find(
 | 
				
			||||||
            channel_uid=channel_message["channel_uid"],
 | 
					            channel_uid=channel_message["channel_uid"],
 | 
				
			||||||
            is_banned=False,
 | 
					            is_banned=False,
 | 
				
			||||||
@ -56,3 +57,5 @@ class NotificationService(BaseService):
 | 
				
			|||||||
                await self.save(model)
 | 
					                await self.save(model)
 | 
				
			||||||
            except Exception as ex:
 | 
					            except Exception as ex:
 | 
				
			||||||
                raise Exception(f"Failed to create notification: {model.errors}.")
 | 
					                raise Exception(f"Failed to create notification: {model.errors}.")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        self.app.db.commit()
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user