Skip to content

RUN-3223: Refactor plugin to improve performance#8

Merged
smartinellibenedetti merged 6 commits into
mainfrom
RUN-3223-clean
Jun 2, 2025
Merged

RUN-3223: Refactor plugin to improve performance#8
smartinellibenedetti merged 6 commits into
mainfrom
RUN-3223-clean

Conversation

@smartinellibenedetti
Copy link
Copy Markdown
Contributor

@smartinellibenedetti smartinellibenedetti commented May 30, 2025

Implemented data flow:

  1. Initial Discovery Process:
    - Fetch a single execution for each visible job
    - Check if execution has ROI metrics
    - For jobs with ROI metrics, fetch executions for a configurable period (default: 10 days)
    - Fetch the roi metrics for each successful execution until it hits a 404 (to avoid retrieving data from executions that never had roi metrics enabled)
    - Save data to IndexedDB
  2. Subsequent Updates:
    - Only fetch data for the missing time periods when users increase date range
    - Leverage cached data when users decrease date range
    - When data is already cached, fetch only today's data for fresh metrics
    - Optimize network requests by batching and concurrent processing
  3. Performance Optimizations:
    - Concurrency pool for limiting parallel API requests (only allow 10 requests in flight);
    - Jobs are processed in batches of 10; executions are processed in batches of 500;
    - Background caching to maintain UI responsiveness
    - Small delays (50ms) between batches to allow UI thread to breathe

Known constraints:

  • the plugin doesn't work on nextUI/alphaUI and it's out of scope of this PR to change that
  • upon checking the checkbox to show jobs without roi metrics, the executions numbers are currently 0 (will address in a follow up PR)
  • need to update the cache cleanup logic to use the timestamp saved in localstorage instead of a settimeout

cache working, but not fetching new data unless cache is 8hrs old
move call to worker
replace endpoint
fix parameter to dates
Update joblist.js
fix time range drama
fix internal graphic
parallel processing for roimetrics
add cache cleanup
Update table.html
add concurrencypool
add lock logic to prevent multiple workers for starting
small cleanup
kill roiworker upon navigating to other pages
ensure that the graph per job will fetch data if needed
cleanup
add events
save all executions in the indexed db, but filter locally the ones that actually have roi data and are successful
remove the -1 from begin time
fix for no roi data found message
fix for html
disable todays flag upon changing data range
track executions total
Copy link
Copy Markdown

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 refactors UI templates to enhance performance and visibility control in the RD plugin.

  • Animates the loading spinner icon.
  • Switches the "No ROI data" message trigger to use sortedJobs() instead of jobs().
  • Hides chart and related info until data is ready.

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

File Description
src/main/rdplugin/resources/html/table.html Added fa-spin to spinner icon; updated empty-state binding.
src/main/rdplugin/resources/html/job-roi.html Wrapped chart and info sections with visibility bindings.
Comments suppressed due to low confidence (2)

src/main/rdplugin/resources/html/table.html:160

  • Changing the empty-state check from jobs() to sortedJobs() may hide the message when the sort filter yields no items but there are jobs present. Confirm this logic aligns with intended behavior or add a comment to clarify.
<div class="alert alert-info" data-bind="visible: jobroilist.sortedJobs().length === 0">

src/main/rdplugin/resources/html/job-roi.html:111

  • [nitpick] Embedding raw <div> tags with visibility bindings can lead to unbalanced markup if sections change. Verify the closing tags remain matched or consider adding a comment to document the structure.
<div data-bind="visible: !loading() && hasRoiData()">


<!-- Chart container with more controlled size -->
<div class="roi-chart-container">
<div class="roi-chart-container" data-bind="visible: !loading() && hasRoiData()">
Copy link

Copilot AI May 30, 2025

Choose a reason for hiding this comment

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

[nitpick] The visible: !loading() && hasRoiData() binding is duplicated on the chart and info containers. Consider wrapping both sections in a single parent element with this binding to reduce repetition.

Copilot uses AI. Check for mistakes.
@smartinellibenedetti smartinellibenedetti changed the title refactor plugin to improve performance RUN-3223: Refactor plugin to improve performance May 30, 2025
@smartinellibenedetti smartinellibenedetti marked this pull request as ready for review May 30, 2025 16:45
@edbaltra edbaltra self-requested a review May 30, 2025 20:32
Copy link
Copy Markdown

@edbaltra edbaltra left a comment

Choose a reason for hiding this comment

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

Everything looks great, I don’t have any comments

@smartinellibenedetti smartinellibenedetti merged commit cc7e954 into main Jun 2, 2025
1 check passed
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