checkpoint before threading post migration
This commit is contained in:
parent
93f5c70236
commit
e473c0e522
@ -27,6 +27,7 @@ func (migration MigratePosts) Execute() []PostResult {
|
||||
if err != nil {
|
||||
panic("Could not migrate posts:" + err.Error())
|
||||
}
|
||||
slowtwitchPostIdsForMigration := getPostIdsThatNeedMigration(slowtwitchPostIds, migratedPostIds)
|
||||
|
||||
//get wordpress tag data, there are only 3
|
||||
tags := []string{"swim", "bike", "run"}
|
||||
@ -35,7 +36,6 @@ func (migration MigratePosts) Execute() []PostResult {
|
||||
panic("Could not migrate posts due to tags not found:" + wpTagErr.Error())
|
||||
}
|
||||
|
||||
slowtwitchPostIdsForMigration := getPostIdsThatNeedMigration(slowtwitchPostIds, migratedPostIds)
|
||||
var postResults []PostResult
|
||||
for _, postId := range slowtwitchPostIdsForMigration {
|
||||
errorMessage := ""
|
||||
@ -231,6 +231,12 @@ func (migration MigratePosts) Execute() []PostResult {
|
||||
postResults = append(postResults, postResult)
|
||||
}
|
||||
// Update related posts once work is done
|
||||
updatePostRelationships(postResults, migration)
|
||||
|
||||
return postResults
|
||||
}
|
||||
|
||||
func updatePostRelationships(postResults []PostResult, migration MigratePosts) {
|
||||
for _, postResult := range postResults {
|
||||
if postResult.IsSuccess {
|
||||
var relatedWordpressIds []int
|
||||
@ -261,8 +267,6 @@ func (migration MigratePosts) Execute() []PostResult {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return postResults
|
||||
}
|
||||
|
||||
func getPostIdsThatNeedMigration(slowtwitchPostIds, migratedPostIds []int) []int {
|
||||
|
Loading…
Reference in New Issue
Block a user