Skip to content

Conversation

@cahirodoherty-learningpool
Copy link
Contributor

Addresses #140

Update

  • Added a '_shouldRetryConnection' flag to decide if LRS connections should be reattempted

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces a new flag, '_shouldRetryConnection', to control whether LRS connection attempts should be retried in various parts of the codebase. Key changes include:

  • Simplifying conditional statements in js/XAPIIndex.js and js/CMI5.js.
  • Adding retry logic in js/XAPI.js for connection initialization, state sending, and statement sending.
  • Implementing a flag-based mechanism to prevent multiple consecutive retry attempts.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
js/XAPIIndex.js Simplified conditional return statement when the config is disabled.
js/XAPI.js Introduced retry logic for LRS connection, state sending, and statement sending with a new flag.
js/CMI5.js Streamlined the exitCourse method with a one-line return if no returnURL is provided.
Comments suppressed due to low confidence (2)

js/XAPI.js:1452

  • The variable 'statements' is not defined in this scope. Please verify the correct variable or value to pass to 'sendStatementsSync'.
this.sendStatementsSync(statements);

js/XAPI.js:1489

  • The variable 'statements' is not defined in this callback scope. Ensure that the correct variable is used or that 'statements' is defined before this call.
this.sendStatementsSync(statements);

@cahirodoherty-learningpool cahirodoherty-learningpool marked this pull request as ready for review May 16, 2025 11:41
@cahirodoherty-learningpool
Copy link
Contributor Author

@oliverfoster Thanks for the valuable feedback. I've made amendments now in line with what you had pointed out. can you please take a look and see if you're happy with those?

@cahirodoherty-learningpool
Copy link
Contributor Author

Holding off on merge pending a full test of the solution

@cahirodoherty-learningpool
Copy link
Contributor Author

@oliverfoster We have tested this in our own content now and can see the retries running and being limited to the correct number. If you're happy I will merge

@oliverfoster
Copy link
Member

Go for it

@cahirodoherty-learningpool cahirodoherty-learningpool merged commit 2a1881d into master Jun 19, 2025
@github-project-automation github-project-automation bot moved this from Needs Reviewing to Recently Released in adapt_framework: The TODO Board Jun 19, 2025
@cahirodoherty-learningpool cahirodoherty-learningpool deleted the issue/140 branch June 19, 2025 14:48
github-actions bot pushed a commit that referenced this pull request Jun 19, 2025
# [1.3.0](v1.2.2...v1.3.0) (2025-06-19)

### Update

* Added a '_shouldRetryConnection' flag to decide if LRS connections should be reattempted (issue 140) (#141) ([2a1881d](2a1881d)), closes [#141](#141)
@github-actions
Copy link

🎉 This PR is included in version 1.3.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants