Skip to content

Commit 5040970

Browse files
fix: remove unnecessary "await" in baseUserRepository.js
Fixes a small bug where we had an `await` call on a function that doesn't return a `Promise`. Technically this is fine, because Node will basically "promisify" the value, but it isn't necessary and creates some extra work for the runtime. Specifically, in this situation, Node will wrap the value in a Promise implicitly and pause execution of the surrounding `async` function to queue up that Promise for resolution. So removing it is semantically equivalent, but improves runtime behavior by eliminating this extra work. Signed-off-by: Andrew Lilley Brinker <abrinker@mitre.org>
1 parent 330cc61 commit 5040970

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/repositories/baseUserRepository.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ class BaseUserRepository extends BaseRepository {
293293
async isAdminOrSecretariat (orgShortName, username, requesterOrg, options = {}, isRegistryObject = true) {
294294
const baseOrgRepository = new BaseOrgRepository()
295295
const org = await baseOrgRepository.findOneByShortName(requesterOrg)
296-
if (await baseOrgRepository.isSecretariat(org) || await this.isAdmin(username, orgShortName, options, isRegistryObject)) {
296+
if (baseOrgRepository.isSecretariat(org) || await this.isAdmin(username, orgShortName, options, isRegistryObject)) {
297297
return true
298298
}
299299
return false

0 commit comments

Comments
 (0)