Handle puppet avatar fetch errors properly

This commit is contained in:
Tulir Asokan 2019-05-23 19:07:34 +03:00
parent 2f78d803c2
commit d7b36d55d7
2 changed files with 13 additions and 3 deletions

View file

@ -326,9 +326,11 @@ func (portal *Portal) UpdateAvatar(user *User, avatar *whatsappExt.ProfilePicInf
}
}
if avatar.Status != 0 {
// 401: ???
// 404: ???
if avatar.Status != 0 && avatar.Status != 404 {
// 401s can happen a lot so let's not log those.
if avatar.Status != 401 {
portal.log.Warnln("Unexpected avatar update status code, not updating.", avatar)
}
return false
}

View file

@ -136,6 +136,14 @@ func (puppet *Puppet) UpdateAvatar(source *User, avatar *whatsappExt.ProfilePicI
}
}
if avatar.Status != 0 && avatar.Status != 404 {
// 401s can happen a lot so let's not log those.
if avatar.Status != 401 {
puppet.log.Warnln("Unexpected avatar update status code, not updating.", avatar)
}
return false
}
if avatar.Tag == puppet.Avatar {
return false
}