Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: search and nonce #688

Merged
merged 15 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ jobs:
- name: Run Barge
working-directory: ${{ github.workspace }}/barge
run: |
bash -x start_ocean.sh --no-dashboard --no-aquarius --no-provider --with-typesense --no-elasticsearch --with-c2d 2>&1 > start_ocean.log &
bash -x start_ocean.sh --no-aquarius --no-provider --no-dashboard --with-c2d --with-typesense 2>&1 > start_ocean.log &

- run: npm ci
- run: npm run build
Expand Down Expand Up @@ -272,13 +272,14 @@ jobs:
P2P_ipV4BindTcpPort: 8000
HTTP_API_PORT: 8001
RPCS: '{ "8996": {"rpc": "http://127.0.0.1:8545", "chainId": 8996, "network": "development", "chunkSize": 100} }'
DB_URL: 'http://localhost:8108/?apiKey=xyz'
DB_URL: 'http://localhost:9200'
FEE_TOKENS: '{ "1": "0x967da4048cD07aB37855c090aAF366e4ce1b9F48", "137": "0x282d8efCe846A88B159800bd4130ad77443Fa1A1", "80001": "0xd8992Ed72C445c35Cb4A2be468568Ed1079357c8", "56": "0xDCe07662CA8EbC241316a15B611c89711414Dd1a" }'
FEE_AMOUNT: '{ "amount": 1, "unit": "MB" }'
AUTHORIZED_DECRYPTERS: '["0xe2DD09d719Da89e5a3D0F2549c7E24566e947260"]'
P2P_ENABLE_UPNP: 'false'
P2P_ENABLE_AUTONAT: 'false'
ALLOWED_ADMINS: '["0xe2DD09d719Da89e5a3D0F2549c7E24566e947260"]'
DB_TYPE: 'elasticsearch'
- name: Check Ocean Node is running
run: |
for i in $(seq 1 90); do
Expand Down
2 changes: 1 addition & 1 deletion src/components/Indexer/processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ class BaseEventProcessor {
INDEXER_LOGGER.logMessage(
`Decrypting DDO from network: ${this.networkId} created by: ${eventCreator} encrypted by: ${decryptorURL}`
)
const nonce = Date.now().toString()
const nonce = Math.floor(Date.now() / 1000).toString()
const { keys } = await getConfiguration()
const nodeId = keys.peerId.toString()

Expand Down
10 changes: 3 additions & 7 deletions src/components/database/ElasticSearchDatabase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,6 @@ export class ElasticsearchOrderDatabase extends AbstractOrderDatabase {
size: maxResultsPerPage || 10
}
}

const result = await this.provider.search(searchParams)
return result.hits.hits.map((hit: any) => hit._source)
} catch (error) {
Expand Down Expand Up @@ -608,18 +607,15 @@ export class ElasticsearchDdoDatabase extends AbstractDdoDatabase {
maxResultsPerPage?: number,
pageNumber?: number
): Promise<any> {
const results = []
try {
const results = []
const maxPerPage = maxResultsPerPage || 100
const from = (pageNumber || 1) * maxPerPage - maxPerPage

for (const schema of this.getSchemas()) {
const response = await this.client.search({
index: schema.index,
body: {
query: {
match: query
},
...query,
from,
size: maxPerPage
}
Expand All @@ -638,7 +634,7 @@ export class ElasticsearchDdoDatabase extends AbstractDdoDatabase {
GENERIC_EMOJIS.EMOJI_CROSS_MARK,
LOG_LEVELS_STR.LEVEL_ERROR
)
return null
return results
}
}

Expand Down
Loading