Skip to content

Commit

Permalink
Request priority (#5737)
Browse files Browse the repository at this point in the history
* Set priority of couch requests to high
* Set priority of image requests to low
* Add e2e test for low-priority images
  • Loading branch information
akhenry committed Sep 13, 2022
1 parent b434a3b commit be4450d
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,10 @@ test.describe('Example Imagery Object', () => {
await expect(pausePlayButton).not.toHaveClass(/is-paused/);
});

test('Uses low fetch priority', async ({ page }) => {
const priority = await page.locator('.js-imageryView-image').getAttribute('fetchpriority');
await expect(priority).toBe('low');
});
});

// The following test case will cover these scenarios
Expand Down
1 change: 1 addition & 0 deletions src/plugins/imagery/components/ImageThumbnail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
<img
class="c-thumb__image"
:src="image.url"
fetchpriority="low"
>
</a>
<div class="c-thumb__timestamp">{{ image.formattedTime }}</div>
Expand Down
1 change: 1 addition & 0 deletions src/plugins/imagery/components/ImageryView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
}"
:data-openmct-image-timestamp="time"
:data-openmct-object-keystring="keyString"
fetchpriority="low"
>
<div
v-if="imageUrl"
Expand Down
1 change: 1 addition & 0 deletions src/plugins/persistence/couch/CouchObjectProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ class CouchObjectProvider {
let fetchOptions = {
method,
body,
priority: 'high',
signal
};

Expand Down
6 changes: 6 additions & 0 deletions src/plugins/persistence/couch/pluginSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@ describe('the plugin', () => {
expect(result.identifier.key).toEqual(mockDomainObject.identifier.key);
});

it('prioritizes couch requests above other requests', async () => {
await openmct.objects.get(mockDomainObject.identifier);
const fetchOptions = fetch.calls.mostRecent().args[1];
expect(fetchOptions.priority).toEqual('high');
});

it('creates an object and starts shared worker', async () => {
const result = await openmct.objects.save(mockDomainObject);
expect(provider.create).toHaveBeenCalled();
Expand Down

0 comments on commit be4450d

Please sign in to comment.