Skip to content

Commit

Permalink
fix: add missing await calls
Browse files Browse the repository at this point in the history
  • Loading branch information
matheusccastroo committed Sep 7, 2024
1 parent ea500a2 commit 4fabb29
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 44 deletions.
2 changes: 1 addition & 1 deletion packages/mongo/mongo_driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -1059,7 +1059,7 @@ class AsynchronousCursor {
// the Mongo->Meteor type replacement).
async _rawNextObjectPromise() {
try {
return this._dbCursor.next();
return (await this._dbCursor.next());
} catch (e) {
console.error(e);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/service-configuration/package.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package.describe({
summary: 'Manage the configuration for third-party services',
version: '1.3.5',
version: '1.3.6',
});

Package.onUse(function(api) {
Expand Down
64 changes: 32 additions & 32 deletions packages/service-configuration/service_configuration_server.js
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
import { Meteor } from 'meteor/meteor';

// Only one configuration should ever exist for each service.
// A unique index helps avoid various race conditions which could
// otherwise lead to an inconsistent database state (when there are multiple
// configurations for a single service, which configuration is correct?)
try {
ServiceConfiguration.configurations.createIndexAsync(
{ service: 1 },
{ unique: true }
);
} catch (err) {
console.error(
'The service-configuration package persists configuration in the ' +
'meteor_accounts_loginServiceConfiguration collection in MongoDB. As ' +
'each service should have exactly one configuration, Meteor ' +
'automatically creates a MongoDB index with a unique constraint on the ' +
' meteor_accounts_loginServiceConfiguration collection. The ' +
'createIndex command which creates that index is failing.\n\n' +
'Meteor versions before 1.0.4 did not create this index. If you recently ' +
'upgraded and are seeing this error message for the first time, please ' +
'check your meteor_accounts_loginServiceConfiguration collection for ' +
'multiple configuration entries for the same service and delete ' +
'configuration entries until there is no more than one configuration ' +
'entry per service.\n\n' +
'If the meteor_accounts_loginServiceConfiguration collection looks ' +
'fine, the createIndex command is failing for some other reason.\n\n' +
'For more information on this history of this issue, please see ' +
'https://github.com/meteor/meteor/pull/3514.\n'
);
throw err;
}
Meteor.startup(async () => {
// Only one configuration should ever exist for each service.
// A unique index helps avoid various race conditions which could
// otherwise lead to an inconsistent database state (when there are multiple
// configurations for a single service, which configuration is correct?)
try {
await ServiceConfiguration.configurations.createIndexAsync(
{ service: 1 },
{ unique: true }
);
} catch (err) {
console.error(
'The service-configuration package persists configuration in the ' +
'meteor_accounts_loginServiceConfiguration collection in MongoDB. As ' +
'each service should have exactly one configuration, Meteor ' +
'automatically creates a MongoDB index with a unique constraint on the ' +
' meteor_accounts_loginServiceConfiguration collection. The ' +
'createIndex command which creates that index is failing.\n\n' +
'Meteor versions before 1.0.4 did not create this index. If you recently ' +
'upgraded and are seeing this error message for the first time, please ' +
'check your meteor_accounts_loginServiceConfiguration collection for ' +
'multiple configuration entries for the same service and delete ' +
'configuration entries until there is no more than one configuration ' +
'entry per service.\n\n' +
'If the meteor_accounts_loginServiceConfiguration collection looks ' +
'fine, the createIndex command is failing for some other reason.\n\n' +
'For more information on this history of this issue, please see ' +
'https://github.com/meteor/meteor/pull/3514.\n'
);
throw err;
}

Meteor.startup(() => {
const settings = Meteor.settings?.packages?.['service-configuration'];
if (!settings) return;
for (const key of Object.keys(settings)) {
ServiceConfiguration.configurations.upsertAsync(
await ServiceConfiguration.configurations.upsertAsync(
{ service: key },
{
$set: settings[key],
Expand Down
21 changes: 11 additions & 10 deletions tools/cli/commands-packages.js
Original file line number Diff line number Diff line change
Expand Up @@ -2851,7 +2851,7 @@ main.registerCommand({
}

try {
var conn = packageClient.loggedInPackagesConnection();
var conn = await packageClient.loggedInPackagesConnection();
} catch (err) {
packageClient.handlePackageServerConnectionError(err);
return 1;
Expand Down Expand Up @@ -2951,8 +2951,9 @@ main.registerCommand({
versions = await catalog.official.getSortedVersions(name);
}

var conn;
try {
var conn = await packageClient.loggedInPackagesConnection();
conn = await packageClient.loggedInPackagesConnection();
} catch (err) {
packageClient.handlePackageServerConnectionError(err);
return 1;
Expand All @@ -2961,16 +2962,16 @@ main.registerCommand({
try {
var status = options.success ? "successfully" : "unsuccessfully";
// XXX: This should probably use progress bars instead.
_.each(versions, function (version) {
for (const version of versions) {
Console.rawInfo(
"Setting " + name + "@" + version + " as " +
status + " migrated ...\n");
packageClient.callPackageServer(
conn,
'_changeVersionMigrationStatus',
name, version, !options.success);
"Setting " + name + "@" + version + " as " +
status + " migrated ...\n");
await packageClient.callPackageServer(
conn,
'_changeVersionMigrationStatus',
name, version, !options.success);
Console.info("done.");
});
}
} catch (err) {
packageClient.handlePackageServerConnectionError(err);
return 1;
Expand Down

0 comments on commit 4fabb29

Please sign in to comment.