Skip to content
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

feat(Navisworks): Retry Sending already converted objects. Implements #2668 #2670

Merged
merged 8 commits into from
Jun 15, 2023

Conversation

jsdbroughton
Copy link
Contributor

@jsdbroughton jsdbroughton commented Jun 13, 2023

This is a highly speculative but functional adaptation. If long sends become possible from the server, this may be moot. I am open to rejections on this.

This PR adds a new Ribbon button that resends a commit that has failed to send to completion post successful Conversion. Motivation is centred around long sends being cancelled, which loses potentially long conversions—wasting users' time.

The converted and draft Commit objects are cached on completing the conversion. A successful Transport and Commit nullify these caches.

The Retry Send button is enabled if the Main thread becomes idle and the cached items still exist, indicating either Transport or the Commit Send failed.

When Retry Send completes, it nullifies the caches, as does changing the document or starting a new Send.

It is a little hacky and isn't completely tied into the DUI just yet - the failed send Sets the CancellationToken as cancelled - can research if this can be uncancelled (A newly created ProgressViewModel is divorced from DUI)

This commit adds a new button to the Navisworks ribbon that allows users to retry sending the last complete conversion to Speckle. The new button is added in Ribbon.xaml and Ribbon.xaml.cs, and its functionality is implemented in RibbonHandler.cs. The code also includes some minor changes such as renaming a command shortcut and adding comments for clarity.
This commit adds caching for the last conversion and commit objects to improve performance when retrying a failed send operation. The cached objects are used in the new `RetryLastConversionSend` method, which allows users to retry sending data without having to re-convert everything from scratch.
This change clears the cachedCommit and cachedConversion variables after creating a commit in ConnectorNavisworksBindings.Send.cs. This ensures that the latest data is always used and avoids any potential issues with stale data.
- Added new using statements for Models and Utilities.
- Added a new method RetryLastConversionSend() to ConnectorBindingsNavisworks class.
- Modified SendConvertedObjectsToSpeckle() and CreateCommit() methods in ConnectorBindingsNavisworks class to use the cached conversion objects.
- Added a new field _cachedState to store the state of the stream before sending data to Speckle.
- Modified ExecuteCommand() method in RibbonHandler class to call RetryLastConversionSend() method from Bindings object instead of directly calling it.
- Created a new field Bindings in SpeckleNavisworksCommandPlugin class.
@jsdbroughton jsdbroughton changed the base branch from main to dev June 13, 2023 22:25
@jsdbroughton jsdbroughton added the navisworks issues related to Navisworks label Jun 13, 2023
@jsdbroughton jsdbroughton linked an issue Jun 13, 2023 that may be closed by this pull request
- Remove unused variables
- Clear cached objects when necessary
@jsdbroughton jsdbroughton marked this pull request as ready for review June 13, 2023 22:39
@jsdbroughton jsdbroughton requested a review from a team June 13, 2023 22:40
@jsdbroughton jsdbroughton added this to the 2.15 milestone Jun 13, 2023
…onnectorBindingsNavisworks.Send.cs

This commit adds a new boolean flag called isRetrying to the ConnectorBindingsNavisworks class. It also handles this flag in the Send method of the same class, where it throws an exception if isRetrying is false and debug mode is enabled.
This commit adds a retry button to the Ribbon in ConnectorNavisworks. It also includes two new resources, "retry16.ico" and "retry32.ico", which are used as icons for the new button. Additionally, some code was commented out that threw an exception when not in debug mode.
Copy link
Contributor

@AlanRynne AlanRynne left a comment

Choose a reason for hiding this comment

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

This is looking good! After your demo yesterday I'm super keen on having this... EVERYWHERE (included as a DUI feature).

Anyhow, in it goes!

@AlanRynne
Copy link
Contributor

AlanRynne commented Jun 15, 2023

Kudos for the detailed message history 🚀

@AlanRynne AlanRynne merged commit 62b2e21 into dev Jun 15, 2023
@AlanRynne AlanRynne deleted the navisworks/jsdb/retry-send-conversion branch June 15, 2023 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
navisworks issues related to Navisworks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat(Navisworks): A Resend last commit Action
2 participants