Convert upsert calls to async in authentication.js .
Thanks to snowsky and xet7 ! Fixes https://github.com/wekan/wekan/pull/6243, fixes https://github.com/wekan/wekan/pull/6245
This commit is contained in:
1 parent
34e7ff532f
commit
dfcaaf0ae7
3 files changed
+18
-18
No files matched your search
@@ -28,11 +28,11 @@ class AttachmentMigrationService {
|
||||
* @param {string} boardId - The board ID
|
||||
* @returns {boolean} - True if board has been migrated
|
||||
*/
|
||||
isBoardMigrated(boardId) {
|
||||
async isBoardMigrated(boardId) {
|
||||
const isMigrated = migratedBoards.has(boardId);
|
||||
|
||||
// Update status collection for pub/sub
|
||||
AttachmentMigrationStatus.upsert(
|
||||
await AttachmentMigrationStatus.upsertAsync(
|
||||
{ boardId },
|
||||
{
|
||||
$set: {
|
||||
@@ -53,7 +53,7 @@ class AttachmentMigrationService {
|
||||
async migrateBoardAttachments(boardId) {
|
||||
try {
|
||||
// Check if board has already been migrated
|
||||
if (this.isBoardMigrated(boardId)) {
|
||||
if (await this.isBoardMigrated(boardId)) {
|
||||
console.log(`Board ${boardId} has already been migrated, skipping`);
|
||||
return { success: true, message: 'Board already migrated' };
|
||||
}
|
||||
@@ -102,7 +102,7 @@ class AttachmentMigrationService {
|
||||
console.log(`Marked board ${boardId} as migrated`);
|
||||
|
||||
// Update status collection
|
||||
AttachmentMigrationStatus.upsert(
|
||||
await AttachmentMigrationStatus.upsertAsync(
|
||||
{ boardId },
|
||||
{
|
||||
$set: {
|
||||
@@ -224,7 +224,7 @@ class AttachmentMigrationService {
|
||||
const migratedCount = total - unconverted.length;
|
||||
|
||||
// Update status collection for pub/sub
|
||||
AttachmentMigrationStatus.upsert(
|
||||
await AttachmentMigrationStatus.upsertAsync(
|
||||
{ boardId },
|
||||
{
|
||||
$set: {
|
||||
|
||||
@@ -75,7 +75,7 @@ Meteor.startup(() => {
|
||||
process.env.ORACLE_OIM_ENABLED === 'true' ||
|
||||
process.env.ORACLE_OIM_ENABLED === true
|
||||
) {
|
||||
ServiceConfiguration.configurations.upsert(
|
||||
ServiceConfiguration.configurations.upsertAsync(
|
||||
// eslint-disable-line no-undef
|
||||
{ service: 'oidc' },
|
||||
{
|
||||
@@ -97,7 +97,7 @@ Meteor.startup(() => {
|
||||
process.env.OAUTH2_ENABLED === 'true' ||
|
||||
process.env.OAUTH2_ENABLED === true
|
||||
) {
|
||||
ServiceConfiguration.configurations.upsert(
|
||||
ServiceConfiguration.configurations.upsertAsync(
|
||||
// eslint-disable-line no-undef
|
||||
{ service: 'oidc' },
|
||||
{
|
||||
@@ -121,7 +121,7 @@ Meteor.startup(() => {
|
||||
process.env.CAS_ENABLED === 'true' ||
|
||||
process.env.CAS_ENABLED === true
|
||||
) {
|
||||
ServiceConfiguration.configurations.upsert(
|
||||
ServiceConfiguration.configurations.upsertAsync(
|
||||
// eslint-disable-line no-undef
|
||||
{ service: 'cas' },
|
||||
{
|
||||
@@ -145,7 +145,7 @@ Meteor.startup(() => {
|
||||
process.env.SAML_ENABLED === 'true' ||
|
||||
process.env.SAML_ENABLED === true
|
||||
) {
|
||||
ServiceConfiguration.configurations.upsert(
|
||||
ServiceConfiguration.configurations.upsertAsync(
|
||||
// eslint-disable-line no-undef
|
||||
{ service: 'saml' },
|
||||
{
|
||||
|
||||
@@ -1713,7 +1713,7 @@ class CronMigrationManager {
|
||||
this.startTime = Date.now();
|
||||
|
||||
// Update CronJobStatus for immediate pub/sub notification
|
||||
CronJobStatus.upsert(
|
||||
await CronJobStatus.upsertAsync(
|
||||
{ jobId: 'migration' },
|
||||
{
|
||||
$set: {
|
||||
@@ -1784,7 +1784,7 @@ class CronMigrationManager {
|
||||
this.isRunning = false;
|
||||
|
||||
// Update CronJobStatus
|
||||
CronJobStatus.upsert(
|
||||
await CronJobStatus.upsertAsync(
|
||||
{ jobId: 'migration' },
|
||||
{
|
||||
$set: {
|
||||
@@ -1800,7 +1800,7 @@ class CronMigrationManager {
|
||||
}
|
||||
|
||||
// Update to running state
|
||||
CronJobStatus.upsert(
|
||||
await CronJobStatus.upsertAsync(
|
||||
{ jobId: 'migration' },
|
||||
{
|
||||
$set: {
|
||||
@@ -2555,7 +2555,7 @@ class CronMigrationManager {
|
||||
cronMigrationStatus.set('Migrations paused');
|
||||
|
||||
// Update CronJobStatus for immediate pub/sub notification
|
||||
CronJobStatus.upsert(
|
||||
await CronJobStatus.upsertAsync(
|
||||
{ jobId: 'migration' },
|
||||
{
|
||||
$set: {
|
||||
@@ -2577,7 +2577,7 @@ class CronMigrationManager {
|
||||
}
|
||||
|
||||
// Update to final paused state
|
||||
CronJobStatus.upsert(
|
||||
await CronJobStatus.upsertAsync(
|
||||
{ jobId: 'migration' },
|
||||
{
|
||||
$set: {
|
||||
@@ -2597,7 +2597,7 @@ class CronMigrationManager {
|
||||
*/
|
||||
async stopAllMigrations() {
|
||||
// Update CronJobStatus for immediate pub/sub notification
|
||||
CronJobStatus.upsert(
|
||||
await CronJobStatus.upsertAsync(
|
||||
{ jobId: 'migration' },
|
||||
{
|
||||
$set: {
|
||||
@@ -2635,7 +2635,7 @@ class CronMigrationManager {
|
||||
cronMigrationStatus.set('All migrations stopped');
|
||||
|
||||
// Update to final stopped state
|
||||
CronJobStatus.upsert(
|
||||
await CronJobStatus.upsertAsync(
|
||||
{ jobId: 'migration' },
|
||||
{
|
||||
$set: {
|
||||
@@ -2649,9 +2649,9 @@ class CronMigrationManager {
|
||||
);
|
||||
|
||||
// Clear status message after delay
|
||||
Meteor.setTimeout(() => {
|
||||
Meteor.setTimeout(async () => {
|
||||
cronMigrationStatus.set('');
|
||||
CronJobStatus.upsert(
|
||||
await CronJobStatus.upsertAsync(
|
||||
{ jobId: 'migration' },
|
||||
{
|
||||
$set: {
|
||||
|
||||
Reference in new issue
Block a user