Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Adding wait time for writing a point to the DB#454

Closed
sankalpanand wants to merge 0 commit intoinfluxdata:masterinfluxdata/influxdb-java:masterfrom
sankalpanand:mastersankalpanand/influxdb-java:masterCopy head branch name to clipboard
Closed

Adding wait time for writing a point to the DB#454
sankalpanand wants to merge 0 commit intoinfluxdata:masterinfluxdata/influxdb-java:masterfrom
sankalpanand:mastersankalpanand/influxdb-java:masterCopy head branch name to clipboard

Conversation

@sankalpanand
Copy link

We've been facing a problem in production for a pretty widely used product. BatchProcessor is currently using a BlockingQueue. There have been times when writing to this queue has blocked our main thread while writing a metric into the queue.

I'm trying to address that issue through this PR by using offer() with a timeout instead of put. This will allow us to simply drop that data point if its taking too long instead of blocking the main thread.


void put(final AbstractBatchEntry batchEntry, final long timeout) {
try {
this.queue.offer(batchEntry, timeout, TimeUnit.SECONDS);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be in TimeUnit.MILLISECONDS

@codecov-io
Copy link

Codecov Report

Merging #454 into master will decrease coverage by 1.16%.
The diff coverage is 0%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #454      +/-   ##
============================================
- Coverage     86.63%   85.46%   -1.17%     
- Complexity      302      303       +1     
============================================
  Files            20       20              
  Lines          1294     1314      +20     
  Branches        135      136       +1     
============================================
+ Hits           1121     1123       +2     
- Misses          113      130      +17     
- Partials         60       61       +1
Impacted Files Coverage Δ Complexity Δ
src/main/java/org/influxdb/InfluxDB.java 100% <ø> (ø) 0 <0> (ø) ⬇️
src/main/java/org/influxdb/impl/InfluxDBImpl.java 84.88% <0%> (-2.81%) 68 <0> (ø)
...rc/main/java/org/influxdb/impl/BatchProcessor.java 92.08% <0%> (-6.38%) 17 <0> (ø)
src/main/java/org/influxdb/InfluxDBException.java 90.9% <0%> (+3.63%) 12% <0%> (+1%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f9ca92f...a1294f4. Read the comment docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.