Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@oscerd
Copy link
Contributor

@oscerd oscerd commented Dec 12, 2025

This should fix #127

@oscerd oscerd changed the title Add Async support feat: Add Async support Dec 12, 2025
@oscerd oscerd closed this Dec 12, 2025
@oscerd oscerd reopened this Dec 12, 2025
@oscerd
Copy link
Contributor Author

oscerd commented Dec 12, 2025

@edeandrea @ThomasVitale

@github-actions
Copy link

github-actions bot commented Dec 12, 2025

:java_duke: JaCoCo coverage report

There is no coverage information present for the Files changed

@github-actions
Copy link

github-actions bot commented Dec 12, 2025

TestsPassed ❌️SkippedFailed
Gradle Test Results (all modules & JDKs)0 ran0 passed0 skipped0 failed
TestResult
No test annotations available

@github-actions
Copy link

HTML test reports are available as workflow artifacts (zipped HTML).

• Download: Artifacts for this run

@oscerd
Copy link
Contributor Author

oscerd commented Dec 12, 2025

No worries. Enjoy the weekend!

Copy link
Contributor

@edeandrea edeandrea left a comment

Choose a reason for hiding this comment

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

I've made a few general comments about how I envisioned the async to work. I was thinking that we would return CompletableFuture objects in the async operations. This would solve a number of issues, but the biggest is that the current implementation polls on the same thread that that it executes the task from. This could lead to deadlock in systems that are not thread-per-request.

Plus other downstream implementors may want to use virtual threads or some other threading mechanism.

Sticking to CompletableFuture allows more more customization by downstream frameworks.

@ThomasVitale thoughts?

@oscerd
Copy link
Contributor Author

oscerd commented Dec 13, 2025

I proposed a new solution with CompletableFuture. If it works for all I'll change to Duration the missing field and add the section to whats new.

Copy link
Contributor

@edeandrea edeandrea left a comment

Choose a reason for hiding this comment

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

See my comments on the DoclingServeConvertApi

I think we only need a single method:

CompletableFuture<ConvertDocumentResponse> convertSource(ConvertDocumentRequest request);

The implementation of that method would handle all the necessary polling to return the completed future once its complete.

At least that was my vision. Thoughts @ThomasVitale ?

@github-actions
Copy link

HTML test reports are available as workflow artifacts (zipped HTML).

• Download: Artifacts for this run

@oscerd
Copy link
Contributor Author

oscerd commented Dec 13, 2025

I guess I'll need to tackle this from scratch again. I was porting the logic coming from Camel, so I could have miss some parts of the API on this side. I'll rework on this next week.

@edeandrea
Copy link
Contributor

I think it's actually simpler than you realize. All the polling apis are already there, plus you already have the logic for polling based on a duration. It's just providing a method which ties everything together.

@oscerd oscerd force-pushed the 127 branch 2 times, most recently from 02759ae to 33f4cea Compare December 15, 2025 08:52
@oscerd
Copy link
Contributor Author

oscerd commented Dec 15, 2025

It should be better now. I spent an hour or so looking at the API a bit deeper.

@github-actions
Copy link

HTML test reports are available as workflow artifacts (zipped HTML).

• Download: Artifacts for this run

@ThomasVitale
Copy link
Contributor

Looks good to me! Just left a couple of comments about the docs. I like the clean API returning CompletableFuture and allowing clients/frameworks to adapt it to different asynchronous setups.

edeandrea
edeandrea previously approved these changes Dec 15, 2025
@edeandrea
Copy link
Contributor

I fixed the docs based on the comments. I will merge this once CI passes!

Thanks a lot @oscerd!

@edeandrea
Copy link
Contributor

@all-contributors add @oscerd as code docs

@allcontributors
Copy link
Contributor

@edeandrea

I've put up a pull request to add @oscerd! 🎉

ThomasVitale
ThomasVitale previously approved these changes Dec 15, 2025
@ThomasVitale
Copy link
Contributor

Great, thank you both! This is a very useful addition to the project.

@edeandrea
Copy link
Contributor

Now we just need to add the async to the chunk apis following the same pattern!

oscerd and others added 3 commits December 15, 2025 16:19
Signed-off-by: Andrea Cosentino <[email protected]>
Simplified the async polling logic in `ConvertOperations` by replacing the custom scheduler with `CompletionStage` chaining. Improved task status handling by centralizing logic for success, failure, and retry behavior. Cleaned up imports and adjusted tests to maintain consistency with updated logic.

Signed-off-by: Eric Deandrea <[email protected]>
Simplified method description by removing unnecessary implementation details about async threading and background polling, focusing on core functionality.

Signed-off-by: Eric Deandrea <[email protected]>
Signed-off-by: Eric Deandrea <[email protected]>
@edeandrea edeandrea dismissed stale reviews from ThomasVitale and themself via e9d869b December 15, 2025 21:25
@github-actions
Copy link

HTML test reports are available as workflow artifacts (zipped HTML).

• Download: Artifacts for this run

@github-actions
Copy link

HTML test reports are available as workflow artifacts (zipped HTML).

• Download: Artifacts for this run

@edeandrea edeandrea merged commit 0a050f1 into docling-project:main Dec 15, 2025
37 of 38 checks passed
@github-actions
Copy link

HTML test reports are available as workflow artifacts (zipped HTML).

• Download: Artifacts for this run

@docling-java-ops
Copy link
Contributor

🎉 This issue has been resolved in v0.4.0 (Release Notes)

@docling-java-ops docling-java-ops bot added the released Issue has been released label Dec 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Issue has been released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add async support

3 participants