mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #5752 from overleaf/tm-history-upgrade-failure-checks
Check for upgradeFailed before classifying/upgrading a project as v1 GitOrigin-RevId: 68776665762e87b640aab4c55a5e56062697912a
This commit is contained in:
parent
ec36fe4b04
commit
5c5f42df1f
3 changed files with 39 additions and 3 deletions
|
@ -20,6 +20,7 @@ const COUNT = {
|
|||
NoneWithoutConversion: 0,
|
||||
NoneWithConversion: 0,
|
||||
NoneWithTemporaryHistory: 0,
|
||||
HistoryUpgradeFailed: 0,
|
||||
}
|
||||
|
||||
// Timestamp of when 'Enable history for SL in background' release
|
||||
|
@ -35,12 +36,30 @@ async function processBatch(_, projects) {
|
|||
}
|
||||
|
||||
async function processProject(project) {
|
||||
if (
|
||||
project.overleaf &&
|
||||
project.overleaf.history &&
|
||||
project.overleaf.history.upgradeFailed
|
||||
) {
|
||||
// a failed history upgrade might look like a v1 project, but history may be broken
|
||||
COUNT.HistoryUpgradeFailed += 1
|
||||
return
|
||||
}
|
||||
if (
|
||||
project.overleaf &&
|
||||
project.overleaf.history &&
|
||||
project.overleaf.history.id
|
||||
) {
|
||||
if (project.overleaf.history.display) {
|
||||
if (project.overleaf.history.upgradeFailed) {
|
||||
COUNT.HistoryUpgradeFailed += 1
|
||||
if (VERBOSE_LOGGING) {
|
||||
console.log(
|
||||
`project ${
|
||||
project[VERBOSE_PROJECT_NAMES ? 'name' : '_id']
|
||||
} has a history upgrade failure recorded`
|
||||
)
|
||||
}
|
||||
} else if (project.overleaf.history.display) {
|
||||
// v2: full project history, do nothing, (query shoudln't include any, but we should stlll check?)
|
||||
COUNT.v2 += 1
|
||||
if (VERBOSE_LOGGING) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
const SCRIPT_VERSION = 1
|
||||
const SCRIPT_VERSION = 2
|
||||
const VERBOSE_LOGGING = process.env.VERBOSE_LOGGING === 'true'
|
||||
const WRITE_CONCURRENCY = parseInt(process.env.WRITE_CONCURRENCY, 10) || 10
|
||||
const BATCH_SIZE = parseInt(process.env.BATCH_SIZE, 10) || 100
|
||||
|
@ -41,6 +41,14 @@ async function processBatch(_, projects) {
|
|||
|
||||
async function processProject(project) {
|
||||
// safety check
|
||||
if (
|
||||
project.overleaf &&
|
||||
project.overleaf.history &&
|
||||
project.overleaf.history.upgradeFailed
|
||||
) {
|
||||
// a failed history upgrade might look like a v1 project, but history may be broken
|
||||
return
|
||||
}
|
||||
if (!projectCreatedAfterFullProjectHistoryEnabled(project)) {
|
||||
return
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
const SCRIPT_VERSION = 2
|
||||
const SCRIPT_VERSION = 3
|
||||
const VERBOSE_LOGGING = process.env.VERBOSE_LOGGING === 'true'
|
||||
const WRITE_CONCURRENCY = parseInt(process.env.WRITE_CONCURRENCY, 10) || 10
|
||||
const BATCH_SIZE = parseInt(process.env.BATCH_SIZE, 10) || 100
|
||||
|
@ -27,6 +27,15 @@ async function processBatch(_, projects) {
|
|||
}
|
||||
|
||||
async function processProject(project) {
|
||||
// safety check
|
||||
if (
|
||||
project.overleaf &&
|
||||
project.overleaf.history &&
|
||||
project.overleaf.history.upgradeFailed
|
||||
) {
|
||||
// a failed history upgrade might look like a v1 project, but history may be broken
|
||||
return
|
||||
}
|
||||
const preserveHistory = await shouldPreserveHistory(project)
|
||||
if (preserveHistory) {
|
||||
// if we need to preserve history, then we must bail out if history exists
|
||||
|
|
Loading…
Reference in a new issue