Refresh remote accounts
This commit is contained in:
parent
4cb6d45788
commit
a5625b4167
7 changed files with 121 additions and 60 deletions
|
@ -1,5 +1,6 @@
|
|||
import * as retry from 'async/retry'
|
||||
import * as Bluebird from 'bluebird'
|
||||
import { Model } from 'sequelize-typescript'
|
||||
import { logger } from './logger'
|
||||
|
||||
type RetryTransactionWrapperOptions = { errorMessage: string, arguments?: any[] }
|
||||
|
@ -34,9 +35,18 @@ function transactionRetryer <T> (func: (err: any, data: T) => any) {
|
|||
})
|
||||
}
|
||||
|
||||
function updateInstanceWithAnother <T> (instanceToUpdate: Model<T>, baseInstance: Model<T>) {
|
||||
const obj = baseInstance.toJSON()
|
||||
|
||||
for (const key of Object.keys(obj)) {
|
||||
instanceToUpdate.set(key, obj[key])
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export {
|
||||
retryTransactionWrapper,
|
||||
transactionRetryer
|
||||
transactionRetryer,
|
||||
updateInstanceWithAnother
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue