Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
I
Indexer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OSDU
OSDU Data Platform
System
Indexer
Commits
3423f8e6
Commit
3423f8e6
authored
4 years ago
by
Aman Verma
Browse files
Options
Downloads
Patches
Plain Diff
removing the async code
parent
e7090ce5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!112
Moving the while loop to iterate over storage records in azure code
Pipeline
#30187
passed
4 years ago
Stage: build
Stage: scan
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
provider/indexer-azure/src/main/java/org/opengroup/osdu/indexer/azure/util/IndexerQueueTaskBuilderAzure.java
+7
-8
7 additions, 8 deletions
...osdu/indexer/azure/util/IndexerQueueTaskBuilderAzure.java
with
7 additions
and
8 deletions
provider/indexer-azure/src/main/java/org/opengroup/osdu/indexer/azure/util/IndexerQueueTaskBuilderAzure.java
+
7
−
8
View file @
3423f8e6
...
...
@@ -41,15 +41,11 @@ import javax.inject.Inject;
import
javax.inject.Named
;
import
java.lang.reflect.Type
;
import
java.nio.charset.StandardCharsets
;
import
java.util.concurrent.Executors
;
import
java.util.concurrent.Future
;
import
java.util.stream.Collectors
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.concurrent.ExecutorService
;
@Log
...
...
@@ -86,9 +82,7 @@ public class IndexerQueueTaskBuilderAzure extends IndexerQueueTaskBuilder {
headers
.
addCorrelationIdIfMissing
();
String
dataPartitionId
=
headers
.
getPartitionIdWithFallbackToAccountId
();
String
correlationId
=
headers
.
getCorrelationId
();
ExecutorService
executorService
=
Executors
.
newFixedThreadPool
(
Runtime
.
getRuntime
().
availableProcessors
());
Future
<
Boolean
>
futureTak
=
executorService
.
submit
(()
->
publishAllRecordsToServiceBus
(
payload
,
dataPartitionId
,
correlationId
));
executorService
.
shutdown
();
publishAllRecordsToServiceBus
(
payload
,
dataPartitionId
,
correlationId
);
}
private
Boolean
publishAllRecordsToServiceBus
(
String
payload
,
String
dataPartitionId
,
String
correlationId
)
{
...
...
@@ -100,12 +94,13 @@ public class IndexerQueueTaskBuilderAzure extends IndexerQueueTaskBuilder {
List
<
RecordInfo
>
recordsAll
=
new
ArrayList
<>();
Map
<
String
,
String
>
attributes
=
new
HashMap
<>();
int
docCount
=
0
;
try
{
attributes
.
put
(
DpsHeaders
.
ACCOUNT_ID
,
dataPartitionId
);
attributes
.
put
(
DpsHeaders
.
DATA_PARTITION_ID
,
dataPartitionId
);
attributes
.
put
(
DpsHeaders
.
CORRELATION_ID
,
correlationId
);
do
{
if
(
recordQueryResponse
!=
null
)
{
recordReindexRequest
=
RecordReindexRequest
.
builder
().
cursor
(
recordQueryResponse
.
getCursor
()).
kind
(
recordKind
).
build
();
...
...
@@ -119,6 +114,9 @@ public class IndexerQueueTaskBuilderAzure extends IndexerQueueTaskBuilder {
records
.
parallelStream
()
.
collect
(
Collectors
.
toCollection
(()
->
recordsAll
));
docCount
=
docCount
+
records
.
size
();
logger
.
info
(
String
.
format
(
"Current doc count is %d "
,
docCount
));
RecordChangedMessages
recordChangedMessages
=
RecordChangedMessages
.
builder
().
data
(
gson
.
toJson
(
records
)).
attributes
(
attributes
).
build
();
String
recordChangedMessagePayload
=
gson
.
toJson
(
recordChangedMessages
);
createTask
(
recordChangedMessagePayload
,
dataPartitionId
,
correlationId
);
...
...
@@ -126,6 +124,7 @@ public class IndexerQueueTaskBuilderAzure extends IndexerQueueTaskBuilder {
}
while
(!
Strings
.
isNullOrEmpty
(
recordQueryResponse
.
getCursor
())
&&
recordQueryResponse
.
getResults
().
size
()
==
configurationProperties
.
getStorageRecordsBatchSize
());
logger
.
info
(
String
.
format
(
"FINAL doc count is %d "
,
docCount
));
}
catch
(
AppException
e
)
{
throw
e
;
}
catch
(
Exception
e
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment