-
Notifications
You must be signed in to change notification settings - Fork 212
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
add batch size field for jira source #5348
add batch size field for jira source #5348
Conversation
Signed-off-by: Maxwell Brown <[email protected]>
Signed-off-by: Maxwell Brown <[email protected]>
@@ -55,7 +55,7 @@ public JiraSource(final PluginMetrics pluginMetrics, | |||
final AcknowledgementSetManager acknowledgementSetManager, | |||
Crawler crawler, | |||
PluginExecutorServiceProvider executorServiceProvider) { | |||
super(PLUGIN_NAME, pluginMetrics, jiraSourceConfig, pluginFactory, acknowledgementSetManager, crawler, executorServiceProvider); | |||
super(PLUGIN_NAME, pluginMetrics, jiraSourceConfig, pluginFactory, acknowledgementSetManager, crawler, executorServiceProvider, jiraSourceConfig.getBatchSize()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are already passing the entire source config object. I think, we don't need to pass the new additional argument?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I see why you did it this way. You can add getBatchSize()
method in CrawlerSourceConfig
then you can avoid this additional argument.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will add to interface
Signed-off-by: Maxwell Brown <[email protected]>
Signed-off-by: Maxwell Brown <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this addition
Signed-off-by: Maxwell Brown <[email protected]>
@JsonProperty("filter") | ||
private FilterConfig filterConfig; | ||
@JsonProperty("batch_size") | ||
private int batchSize = 50; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest you add a private static final variable at the top of the class and set it there. Assign that variable here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
verify(coordinator, never()).createPartition(any(SaasSourcePartition.class)); | ||
} | ||
|
||
@Test | ||
void testCrawlWithNonEmptyList() throws NoSuchFieldException, IllegalAccessException { | ||
Instant lastPollTime = Instant.ofEpochMilli(0); | ||
List<ItemInfo> itemInfoList = new ArrayList<>(); | ||
int maxItemsPerPage = getMaxItemsPerPage(); | ||
int maxItemsPerPage = 50; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be moved out of the test and directly reference the default from the class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -91,27 +91,50 @@ void testCrawlWithNonEmptyList() throws NoSuchFieldException, IllegalAccessExcep | |||
void testCrawlWithMultiplePartitions() throws NoSuchFieldException, IllegalAccessException { | |||
Instant lastPollTime = Instant.ofEpochMilli(0); | |||
List<ItemInfo> itemInfoList = new ArrayList<>(); | |||
int maxItemsPerPage = getMaxItemsPerPage(); | |||
int maxItemsPerPage = 50; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be moved out of the test and directly reference the default from the class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
} | ||
|
||
@Test | ||
void testCrawlWithNullItemsInList() throws NoSuchFieldException, IllegalAccessException { | ||
Instant lastPollTime = Instant.ofEpochMilli(0); | ||
List<ItemInfo> itemInfoList = new ArrayList<>(); | ||
int maxItemsPerPage = getMaxItemsPerPage(); | ||
int maxItemsPerPage = 50; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be moved out of the test and directly reference the default from the class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -122,7 +145,8 @@ void testUpdatingPollTimeNullMetaData() { | |||
ItemInfo testItem = createTestItemInfo("1"); | |||
itemInfoList.add(testItem); | |||
when(client.listItems()).thenReturn(itemInfoList.iterator()); | |||
Instant updatedPollTime = crawler.crawl(lastPollTime, coordinator); | |||
int maxItemsPerPage = 50; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be moved out of the test and directly reference the default from the class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -133,17 +157,11 @@ void testUpdatedPollTimeNiCreatedLarger() { | |||
ItemInfo testItem = createTestItemInfo("1"); | |||
itemInfoList.add(testItem); | |||
when(client.listItems()).thenReturn(itemInfoList.iterator()); | |||
Instant updatedPollTime = crawler.crawl(lastPollTime, coordinator); | |||
int maxItemsPerPage = 50; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be moved out of the test and directly reference the default from the class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Signed-off-by: Maxwell Brown <[email protected]>
Description
Allow user to specify batch_size field in jira source.
Also works for all future saas_crawler sources.
Default value is 50 in jira source
cleanup unnecessary config fields
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.