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: replace Bluebird usage with native Promise API #8318

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

hainenber
Copy link

@hainenber hainenber commented Sep 24, 2024

Description

Replace Bluebird usage in all @osd packages and own codebase with native Promise API.

Issues Resolved

Screenshot

Testing the changes

All CI should pass

Changelog

  • feat: replace Bluebird usage with native Promise

Check List

  • All tests pass
    • yarn test:jest
    • yarn test:jest_integration
  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

Copy link
Contributor

❌ Invalid Prefix For Manual Changeset Creation

Invalid description prefix. Found "feat". Only "skip" entry option is permitted for manual commit of changeset files.

If you were trying to skip the changelog entry, please use the "skip" entry option in the ##Changelog section of your PR description.

@hainenber hainenber changed the title feat: replace Bluebird usage with native Promise feat: replace Bluebird usage with native Promise API Sep 24, 2024
Copy link
Contributor

❌ Invalid Prefix For Manual Changeset Creation

Invalid description prefix. Found "feat". Only "skip" entry option is permitted for manual commit of changeset files.

If you were trying to skip the changelog entry, please use the "skip" entry option in the ##Changelog section of your PR description.

1 similar comment
Copy link
Contributor

❌ Invalid Prefix For Manual Changeset Creation

Invalid description prefix. Found "feat". Only "skip" entry option is permitted for manual commit of changeset files.

If you were trying to skip the changelog entry, please use the "skip" entry option in the ##Changelog section of your PR description.


import { createListStream, createPromiseFromStreams, createConcatStream } from '../streams';

import { createGenerateDocRecordsStream } from './generate_doc_records_stream';
import { Progress } from '../progress';
import { createStubStats, createStubClient } from './test_stubs';

const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's use timers/promises

Copy link
Author

Choose a reason for hiding this comment

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

Fixed in HEAD. Thanks!


import { createListStream, createPromiseFromStreams } from '../streams';

import { Progress } from '../progress';
import { createIndexDocRecordsStream } from './index_doc_records_stream';
import { createStubStats, createStubClient, createPersonDocRecords } from './test_stubs';
import { nextTick } from '../../../../../src/test_utils/public/helpers';
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's use timers/promises

Copy link
Author

Choose a reason for hiding this comment

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

Fixed in HEAD. Thanks!

import { createPromiseFromStreams } from './promise_from_streams';
import { createListStream } from './list_stream';
import { createMapStream } from './map_stream';
import { createConcatStream } from './concat_stream';
import { nextTick } from '../../../../../src/test_utils/public/helpers';
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's use timers/promises

Copy link
Author

Choose a reason for hiding this comment

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

Fixed in HEAD. Thanks!

@@ -28,7 +28,7 @@
* under the License.
*/

import { delay } from 'bluebird';
import { nextTick } from '../../../../../../src/test_utils/public/helpers';
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's use timers/promises

Copy link
Author

Choose a reason for hiding this comment

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

Fixed in HEAD. Thanks!

@@ -33,7 +33,7 @@
// eslint-disable-next-line max-classes-per-file
import { EventEmitter } from 'events';
import { assign, random } from 'lodash';
import { delay } from 'bluebird';
import { nextTick } from '../../../src/test_utils/public/helpers';
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's use timers/promises

Copy link
Author

Choose a reason for hiding this comment

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

Fixed in HEAD. Thanks!

import { createPromiseFromStreams } from './promise_from_streams';
import { createListStream } from './list_stream';
import { createMapStream } from './map_stream';
import { createConcatStream } from './concat_stream';
import { nextTick } from '../../../../../src/test_utils/public/helpers';
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's use timers/promises

Copy link
Author

Choose a reason for hiding this comment

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

Fixed in HEAD. Thanks!

import { TagCloud } from './tag_cloud';
import { setHTMLElementOffset, setSVGElementGetBBox } from '../../../../test_utils/public';
import { nextTick } from '../../../../test_utils/public/helpers';
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's use timers/promises

Copy link
Author

Choose a reason for hiding this comment

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

Fixed in HEAD. Thanks!

Comment on lines 86 to 88
seriesLists.map(function (seriesList) {
return seriesList.list[0];
})
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit

Suggested change
seriesLists.map(function (seriesList) {
return seriesList.list[0];
})
seriesLists.map(({ list }) => list[0])

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for the nit. I've fixed this in local and push. Would like to commit yours but looks like it'll get flagged as ESLint issue :((

@@ -28,7 +28,7 @@
* under the License.
*/

import { delay } from 'bluebird';
import { nextTick } from 'src/test_utils/public/helpers';
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's use timers/promises

Copy link
Author

Choose a reason for hiding this comment

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

Fixed in HEAD. Thanks!

@@ -28,7 +28,7 @@
* under the License.
*/

import { delay } from 'bluebird';
import { nextTick } from 'src/test_utils/public/helpers';
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's use timers/promises

Copy link
Author

Choose a reason for hiding this comment

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

Fixed in HEAD. Thanks!

import { WebElement, WebDriver, By, Key } from 'selenium-webdriver';
import { PNG } from 'pngjs';
import { nextTick } from 'src/test_utils/public/helpers';
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's use timers/promises

Copy link
Author

Choose a reason for hiding this comment

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

Fixed in HEAD. Thanks!

@@ -15981,7 +15976,7 @@ string-similarity@^4.0.1:
resolved "https://registry.yarnpkg.com/string-similarity/-/string-similarity-4.0.4.tgz#42d01ab0b34660ea8a018da8f56a3309bb8b2a5b"
integrity sha512-/q/8Q4Bl4ZKAPjj8WerIBJWALKkaPRfrvhfF8k/B23i4nzrlRj2/go1m90In7nG/3XDSbOo0+pu6RvCTM9RGMQ==

"string-width-cjs@npm:string-width@^4.2.0":
"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you please undo these unrelated changes?

Copy link
Author

Choose a reason for hiding this comment

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

This was stuck after running yarn, btw

Copy link
Collaborator

@AMoo-Miki AMoo-Miki left a comment

Choose a reason for hiding this comment

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

Thanks for this. Please don't mind the repeated texts; they are for my tracking.

Copy link

codecov bot commented Oct 4, 2024

Codecov Report

Attention: Patch coverage is 77.77778% with 2 lines in your changes missing coverage. Please review.

Project coverage is 60.96%. Comparing base (f4f251d) to head (1838a3e).

Files with missing lines Patch % Lines
...kages/osd-opensearch-archiver/src/lib/directory.ts 0.00% 1 Missing ⚠️
...ne/server/series_functions/worldbank_indicators.js 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #8318   +/-   ##
=======================================
  Coverage   60.95%   60.96%           
=======================================
  Files        3766     3766           
  Lines       89364    89361    -3     
  Branches    13978    13978           
=======================================
+ Hits        54468    54475    +7     
+ Misses      31498    31488   -10     
  Partials     3398     3398           
Flag Coverage Δ
Linux_1 28.96% <71.42%> (-0.01%) ⬇️
Linux_2 56.30% <33.33%> (+<0.01%) ⬆️
Linux_3 37.77% <ø> (?)
Linux_4 29.93% <100.00%> (+<0.01%) ⬆️
Windows_1 28.98% <71.42%> (-0.01%) ⬇️
Windows_2 56.25% <33.33%> (+<0.01%) ⬆️
Windows_3 37.77% <ø> (+<0.01%) ⬆️
Windows_4 29.93% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ananzh ananzh added the v2.19.0 label Oct 30, 2024
@ananzh
Copy link
Member

ananzh commented Oct 30, 2024

@hainenber thanks for contributing. Could you fix the comment? I currently add this to 2.19. If no progress, we will need to move this to draft then.

@hainenber
Copy link
Author

hello there, I believe I've addressed the comments as they're now outdated :D

Let me know if there's anything I can do to move the PR forward!

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

Successfully merging this pull request may close these issues.

3 participants