Skip to content

Conversation

@aarnapant-sap
Copy link
Collaborator

@aarnapant-sap aarnapant-sap commented Nov 4, 2025

Push Channel Support for long running jobs:

Backlog link : https://jira.tools.sap/browse/ADTIRA-1494

Changes Made:

  • Changed IProgressWithRunnable based UI thread-blocking approach with Job based approach in PullWizard
  • Updates are reflected in the progressView now
  • Added utility class for AbapGitView
  • Added resource handling

@aarnapant-sap aarnapant-sap force-pushed the feature/background-job-implementation branch from 8c667d0 to c09cf6d Compare November 13, 2025 08:12
public interface IRepositoryService {

// CHNG: Remove new pull relation
String RELATION_PULL_WITHOUT_BG = "http://www.sap.com/adt/abapgit/relations/pullwithoutbg"; //$NON-NLS-1$
Copy link
Collaborator

Choose a reason for hiding this comment

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

Change the URI as per backend, pull/v2

Comment on lines 301 to 303
URI backgroundUri = AdtBackgroundRunUriDiscoveryFactory.createBackgroundRunUriDiscovery(this.destinationId)
.getBackgroundRunUriIfAuthorized(monitor);
IRestResource restResource = AdtBackgroundRestResourceFactory.createBackgroundRestResourceFactory()
Copy link
Collaborator

Choose a reason for hiding this comment

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

If the background URI is unsupported, should we provide a fallback to an older resource? While it's unlikely given that we only support cloud systems, this should be verified once.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

How can I check whether the URI is supported or not?

Copy link
Collaborator

Choose a reason for hiding this comment

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

We already have a method isBackgroundJobSupported in repository service.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure thanks will check it out

Comment on lines +209 to +211
pullRepoJob.schedule();

return true;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we somehow trigger a refresh of the view once the job has finished ?
The status is not updated in the viewer after job has completed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

in the AbapGitView I see a updateView(true) after pull action is triggered however I also don't see it actually refreshing once the pull is done. Will check why thats happening

Copy link
Collaborator

Choose a reason for hiding this comment

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

Please check the callback related logic in other comment. What are your thoughts on it.

// CHNG: Remove new pull relation
String RELATION_PULL_WITHOUT_BG = "http://www.sap.com/adt/abapgit/relations/pullwithoutbg"; //$NON-NLS-1$
String RELATION_PULL = "http://www.sap.com/adt/abapgit/relations/pull"; //$NON-NLS-1$
String RELATION_PULL_WITHOUT_BG = "http://www.sap.com/adt/abapgit/relations/pull/v2"; //$NON-NLS-1$
Copy link
Collaborator

Choose a reason for hiding this comment

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

Variable name, could be RELATION_PULL_WITH_BG_RUN


private final String destinationId;
private final URI uri;
private String result;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This variable is not used.


}

// CHNG: Change it back to original pull relation
Copy link
Collaborator

Choose a reason for hiding this comment

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

Remove the comment.


IRestResource restResource = null;
URI uriToRepo = null;
// check if background job framework is available and is accessible by the user.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Remove comments. The method names should be sufficient.

}

public void refreshView() {
org.eclipse.swt.widgets.Display.getDefault().asyncExec(() -> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Import Display API and then use.

Comment on lines +25 to +27
IViewPart view = page.findView(AbapGitView.ID);
if (view instanceof AbapGitView) {
((AbapGitView) view).refresh();
Copy link
Collaborator

Choose a reason for hiding this comment

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

This logic needs to find the view from all the active views.
I want to avoid this call.
Hence, looking at some other way to keep stuff decoupled.

So,

  1. Refresh of a view should be decoupled from the pull wizard.
  2. Refresh should be part of the action which starts the pull.
  3. Avoid a central disconnected utility just to refresh UI.

Hence I was looking into a callback mechanism.

Copy link
Collaborator

Choose a reason for hiding this comment

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

In our actionPullWizard implementation, we could first implement a callback as lamba expression.


		this.actionPullWizard = new Action() {

			private IRepository selRepo;

			public void run() {
				// Create callback that refreshes the view
				Runnable onPullComplete = () -> AbapGitView.this.updateView(true);

and we can send it within the constructor of AbapGitWizardPull and add it as an instance variable.

Then in our finally block of the job, we can run this call back.

} finally {
					// Execute callback after job completes
					if (AbapGitWizardPull.this.onPullComplete!= null) {
						Display.getDefault().asyncExec(AbapGitWizardPull.this.onPullComplete);
					}
				}

Copy link
Collaborator

Choose a reason for hiding this comment

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

But also this could be over-engineering and we can as well just pass the AbapGit view instance to the wizard and refresh the view.
Given we have the wizards initiated directly from the view, this should be fine as well.

Comment on lines +209 to +211
pullRepoJob.schedule();

return true;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please check the callback related logic in other comment. What are your thoughts on it.

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants