Make sure we've acquired the room lock before checking the mxid
This commit is contained in:
@@ -172,14 +172,14 @@ func (p *Portal) MainIntent() *appservice.IntentAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (p *Portal) createMatrixRoom(user *User, channel *discordgo.Channel) error {
|
func (p *Portal) createMatrixRoom(user *User, channel *discordgo.Channel) error {
|
||||||
|
p.roomCreateLock.Lock()
|
||||||
|
defer p.roomCreateLock.Unlock()
|
||||||
|
|
||||||
// If we have a matrix id the room should exist so we have nothing to do.
|
// If we have a matrix id the room should exist so we have nothing to do.
|
||||||
if p.MXID != "" {
|
if p.MXID != "" {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
p.roomCreateLock.Lock()
|
|
||||||
defer p.roomCreateLock.Unlock()
|
|
||||||
|
|
||||||
p.Type = channel.Type
|
p.Type = channel.Type
|
||||||
if p.Type == discordgo.ChannelTypeDM {
|
if p.Type == discordgo.ChannelTypeDM {
|
||||||
p.DMUser = channel.Recipients[0].ID
|
p.DMUser = channel.Recipients[0].ID
|
||||||
|
|||||||
Reference in New Issue
Block a user