Skip to content
Snippets Groups Projects
Commit 37889fbb authored by Benoit Lavenier's avatar Benoit Lavenier
Browse files

run format:all

parent d31802f5
No related branches found
No related tags found
1 merge request!1422Optimize response time of `/wot/requirements/:search`
...@@ -935,7 +935,11 @@ export class FileDAL implements ServerDAO { ...@@ -935,7 +935,11 @@ export class FileDAL implements ServerDAO {
async searchJustIdentitiesByPubkey(pubkey: string): Promise<DBIdentity[]> { async searchJustIdentitiesByPubkey(pubkey: string): Promise<DBIdentity[]> {
const pendings = await this.idtyDAL.findByPub(pubkey); const pendings = await this.idtyDAL.findByPub(pubkey);
const writtenIdty = await this.iindexDAL.getOldFromPubkey(pubkey); const writtenIdty = await this.iindexDAL.getOldFromPubkey(pubkey);
const nonPendings = writtenIdty && Underscore.where(pendings, { pubkey: writtenIdty.pub }).length === 0 ? [writtenIdty] : []; const nonPendings =
writtenIdty &&
Underscore.where(pendings, { pubkey: writtenIdty.pub }).length === 0
? [writtenIdty]
: [];
const found = pendings.concat( const found = pendings.concat(
nonPendings.map((i: any) => { nonPendings.map((i: any) => {
// Use the correct field // Use the correct field
...@@ -1725,7 +1729,7 @@ export class FileDAL implements ServerDAO { ...@@ -1725,7 +1729,7 @@ export class FileDAL implements ServerDAO {
local_iindex: IindexEntry[] local_iindex: IindexEntry[]
): Promise<SimpleUdEntryForWallet[]> { ): Promise<SimpleUdEntryForWallet[]> {
if (dividend) { if (dividend) {
let udSources = this.dividendDAL.produceDividend( const udSources = this.dividendDAL.produceDividend(
blockNumber, blockNumber,
dividend, dividend,
unitbase, unitbase,
......
import {FullIindexEntry, IindexEntry, Indexer, reduce} from "../../../indexer"; import {
FullIindexEntry,
IindexEntry,
Indexer,
reduce,
} from "../../../indexer";
import { SQLiteDriver } from "../../drivers/SQLiteDriver"; import { SQLiteDriver } from "../../drivers/SQLiteDriver";
import { MonitorExecutionTime } from "../../../debug/MonitorExecutionTime"; import { MonitorExecutionTime } from "../../../debug/MonitorExecutionTime";
import { IIndexDAO } from "../abstract/IIndexDAO"; import { IIndexDAO } from "../abstract/IIndexDAO";
...@@ -214,7 +219,10 @@ export class SqliteIIndex extends SqliteTable<IindexEntry> ...@@ -214,7 +219,10 @@ export class SqliteIIndex extends SqliteTable<IindexEntry>
@MonitorExecutionTime() @MonitorExecutionTime()
async getOldFromPubkey(pub: string): Promise<OldIindexEntry | null> { async getOldFromPubkey(pub: string): Promise<OldIindexEntry | null> {
const identities = await this.find("SELECT * FROM iindex WHERE pub = ? order by writtenOn ASC", [pub]); const identities = await this.find(
"SELECT * FROM iindex WHERE pub = ? order by writtenOn ASC",
[pub]
);
if (!identities.length) { if (!identities.length) {
return null; return null;
} }
......
...@@ -193,8 +193,7 @@ export class WOTBinding extends AbstractController { ...@@ -193,8 +193,7 @@ export class WOTBinding extends AbstractController {
throw BMAConstants.ERRORS.NO_IDTY_MATCHING_PUB_OR_UID; throw BMAConstants.ERRORS.NO_IDTY_MATCHING_PUB_OR_UID;
} }
identities = await this.IdentityService.searchIdentitiesByPubkey(search); identities = await this.IdentityService.searchIdentitiesByPubkey(search);
} } else {
else {
identities = await this.IdentityService.searchIdentities(search); identities = await this.IdentityService.searchIdentities(search);
} }
const all: HttpIdentityRequirement[] = await this.BlockchainService.requirementsOfIdentities( const all: HttpIdentityRequirement[] = await this.BlockchainService.requirementsOfIdentities(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment