mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2024-09-11 13:37:10 +03:00
chore(plugins): gracefully handle plugin update failure
Upon an failed update, rollback to the previous version.
This commit is contained in:
parent
3870d6349f
commit
014cdb5981
@ -427,12 +427,19 @@ export class PluginManager implements ServerHook {
|
||||
|
||||
// Use the latest version from DB, to not upgrade to a version that does not support our PeerTube version
|
||||
let version: string
|
||||
const plugin = await PluginModel.loadByNpmName(toUpdate)
|
||||
|
||||
if (!fromDisk) {
|
||||
const plugin = await PluginModel.loadByNpmName(toUpdate)
|
||||
version = plugin.latestVersion
|
||||
}
|
||||
|
||||
return this.install({ toInstall: toUpdate, version, fromDisk })
|
||||
try {
|
||||
return this.install({ toInstall: toUpdate, version, fromDisk })
|
||||
} catch (err) {
|
||||
logger.info('Reinstalling last installed version.', { err })
|
||||
|
||||
return this.install({ toInstall: toUpdate, version: plugin.version })
|
||||
}
|
||||
}
|
||||
|
||||
async uninstall (options: {
|
||||
|
Loading…
Reference in New Issue
Block a user