mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
check for confirmed transaction within semaphore lock
This commit is contained in:
parent
c0b3a93a59
commit
c585b2c234
@ -553,11 +553,15 @@ export class ContributionResolver {
|
||||
@Arg('id', () => Int) id: number,
|
||||
@Ctx() context: Context,
|
||||
): Promise<boolean> {
|
||||
// acquire lock
|
||||
const releaseLock = await TRANSACTIONS_LOCK.acquire()
|
||||
|
||||
const clientTimezoneOffset = getClientTimezoneOffset(context)
|
||||
const contribution = await DbContribution.findOne(id)
|
||||
|
||||
const contribution = await DbContribution.findOne({ id, confirmedAt: IsNull() })
|
||||
if (!contribution) {
|
||||
logger.error(`Contribution not found for given id: ${id}`)
|
||||
throw new Error('Contribution not found to given id.')
|
||||
logger.error(`Contribution not found to given id (${id}) or already confirmed`)
|
||||
throw new Error('Contribution not found to given id or already confirmed.')
|
||||
}
|
||||
const moderatorUser = getUser(context)
|
||||
if (moderatorUser.id === contribution.userId) {
|
||||
@ -580,9 +584,6 @@ export class ContributionResolver {
|
||||
clientTimezoneOffset,
|
||||
)
|
||||
|
||||
// acquire lock
|
||||
const releaseLock = await TRANSACTIONS_LOCK.acquire()
|
||||
|
||||
const receivedCallDate = new Date()
|
||||
const queryRunner = getConnection().createQueryRunner()
|
||||
await queryRunner.connect()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user