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

Chain Event Types Removal Finale #3309

Merged
merged 101 commits into from
Apr 2, 2023
Merged

Chain Event Types Removal Finale #3309

merged 101 commits into from
Apr 2, 2023

Conversation

timolegros
Copy link
Collaborator

@timolegros timolegros commented Apr 1, 2023

Link to Issue

Closes: #2949

Description of Changes

This PR is nearly identical to #3044 with the only changes being to redo some of the changes that we're reverted in the last attempt at deploying chain-event-types removal.

Hugely reduces Notifications table size (5,426,564 -> 150,834 rows). DB total size reduced from 10.1GB to 2.4GB. This PR also massively reduces the number of notifications and subscriptions created giving us much more time to properly redesign notifications to facilitate scaling. We should also see a considerable performance gain for pg:copy operations or full DB dumps.

Test Plan

  • Deployed to Frick

Deployment Plan

  1. Turn off CE subscribers - wait a couple of seconds for existing queued messages to be processed.
  2. Turn off CW consumer
  3. Put the commonwealthapp in maintenance mode
  4. Put chain-events in maintenance mode
  5. Deploy CW and CE (any order)
  6. Turn back on the CW consumer then the CE subscribers once deployments are over
  7. Turn off maintenance mode on CE first then CW

Other Considerations

# Conflicts:
#	packages/chain-events/services/ChainEventsConsumer/ChainEventHandlers/migration.ts
#	packages/commonwealth/client/scripts/controllers/server/chain_entities.ts
# Conflicts:
#	packages/commonwealth/server/models/subscription.ts
# Conflicts:
#	packages/chain-events/services/ChainEventsConsumer/ChainEventHandlers/entityArchival.ts
#	packages/chain-events/services/ChainEventsConsumer/ChainEventHandlers/migration.ts
#	packages/chain-events/services/ChainEventsConsumer/ChainEventHandlers/notification.ts
#	packages/chain-events/services/ChainEventsConsumer/ChainEventHandlers/storage.ts
#	packages/chain-events/services/ChainEventsConsumer/republishMessages.ts
#	packages/chain-events/services/ChainSubscriber/util.ts
#	packages/chain-events/services/database/database.ts
#	packages/chain-events/services/database/models/chain_event.ts
#	packages/chain-events/services/database/models/chain_event_type.ts
#	packages/chain-events/src/interfaces.ts
#	packages/chain-events/test/integration/service-tests/chainEventsConsumer.test.ts
#	packages/common-common/src/rabbitmq/RabbitMQConfig.ts
#	packages/common-common/src/rabbitmq/rabbitMQController.ts
#	packages/common-common/src/rabbitmq/types/chainEventNotificationsCUD.ts
#	packages/common-common/src/rabbitmq/types/chainEventTypeCUD.ts
#	packages/common-common/src/rabbitmq/types/index.ts
#	packages/commonwealth/client/scripts/controllers/server/chain_entities.ts
#	packages/commonwealth/client/scripts/controllers/server/notifications.ts
#	packages/commonwealth/client/scripts/controllers/server/socket/chainEventsNs.ts
#	packages/commonwealth/client/scripts/models/ChainEvent.ts
#	packages/commonwealth/client/scripts/models/DashboardActivityNotification.ts
#	packages/commonwealth/client/scripts/models/Notification.ts
#	packages/commonwealth/client/scripts/state.ts
#	packages/commonwealth/server/CommonwealthConsumer/CommonwealthConsumer.ts
#	packages/commonwealth/server/CommonwealthConsumer/messageProcessors/chainEventTypeCUDQueue.ts
#	packages/commonwealth/server/models.ts
#	packages/commonwealth/server/models/chain_event_type.ts
#	packages/commonwealth/server/models/notification.ts
#	packages/commonwealth/server/models/subscription.ts
#	packages/commonwealth/server/routes/deleteChain.ts
#	packages/commonwealth/server/routes/getSubscribedChains.ts
#	packages/commonwealth/server/routes/subscription/createSubscription.ts
#	packages/commonwealth/server/scripts/enforceDataConsistency.ts
#	packages/commonwealth/server/socket/chainEventsNs.ts
#	packages/commonwealth/server/util/emitNotifications.ts
#	packages/commonwealth/test/integration/enforceDataConsistency.spec.ts
#	packages/commonwealth/test/systemTests/consumer.test.ts
# Conflicts:
#	packages/chain-events/services/ChainEventsConsumer/republishMessages.ts
@timolegros timolegros temporarily deployed to chain-events-staging April 1, 2023 05:19 Inactive
@timolegros timolegros temporarily deployed to commonwealth-staging April 2, 2023 04:10 Inactive
@timolegros timolegros temporarily deployed to chain-events-staging April 2, 2023 04:11 Inactive
@timolegros timolegros temporarily deployed to chain-events-staging April 2, 2023 05:30 Inactive
@timolegros timolegros temporarily deployed to chain-events-staging April 2, 2023 05:44 Inactive
@timolegros timolegros temporarily deployed to chain-events-staging April 2, 2023 05:54 Inactive
@timolegros timolegros temporarily deployed to chain-events-staging April 2, 2023 06:31 Inactive
@timolegros timolegros marked this pull request as ready for review April 2, 2023 07:26
@jnaviask jnaviask merged commit 6632d14 into master Apr 2, 2023
@jnaviask jnaviask deleted the tim.remove-event-types-2 branch April 2, 2023 15:11
timolegros added a commit that referenced this pull request Apr 4, 2023
* from event-types client side

* move chain + network to event -> working chain activity dashboard

* switch ce commands to ts-node-dev

* chain + network added to event in ChainEventConsumer

* save

* filter out non entity creation/completion events for notifications

* remove EventTypeCUD RabbitMQ types + config + pub/sub calls

* remove ChainEventType model

* remove chain-event-type migration

* CET model removal fixes

* CW remove CET migration

* CW remove CET model

* CET removal migrations + model update

* migration fixes

* migration fixes

* chain subscriptions + chain-event notification settings + subscribedChains

* add full chain to createSubscription route result + fix UI

* turn off sourceMap, use proper tsconfig when building ce, and fixed scraper imports

* add type check to CI + fix type errors

* add type check to CI + fix type errors + remove format in CE repo

* set allowJs: false in tsconfig so sourceMap files don't interrupt ts-node

* RabbitMQ merge fixes

* Make CI lint only the changes in the branch rather than everything

* fix tsconfig + run prettier

* merge fixes

* merge fixes

* discoverReconnectRange fix

* consumer erc20 notification handler bug fix

* load-env-var fix

* Procfile fix

* master merge fixes

* fix chain-event notifications

* fix chain-event email notifications

* format

* format

* CE css fix

* remove subscriptions count for chain-events

* fix getSubscribedChains call

* notification settings page fixes + remove unnecessary logs

* format

* delete script

* migration script fix

* prettier format

* publishCustomRabbitMQMessage.ts improvements

* prettier format

* more script improvements for testing/QA

* add dump file to gitignore

* 8 min local

* 15 seconds local

* add fkey from NR to Sub

* format

* eslint + format + .prettierignore update

* Ensure CET Removal Backwards Compatibility. (#2765)

* Use CE proxy for events too.

* Ensure backwards compatibility for deployment + fix link to chain.

* Prettier fixes.

* Remove log.

* fixed type errors

* fix lint

* fix lint

* format

* small logging fix

* migration log improvement

* ce procfile fix

* add missing index to notif table

* Subscriptions pkey + not null

* fix type

* test improved CE queries

* Procfile fix

* heroku test

* heroku test 2

* cleaup

* redo migration

* redo migration CE + network migration fix

* fix order of CE migrations

* logging for debugging 503

* error handling CE - 503 debugging

* event route - 503 debugging

* optimize event route db query

* prettier

---------

Co-authored-by: Jake Naviasky <jake@commonwealth.im>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Muon Shot <120686579+CowMuon@users.noreply.github.com>

(cherry picked from commit 6632d14)
jnaviask added a commit that referenced this pull request Apr 10, 2023
* Chain Event Types Removal Finale (#3309)

* from event-types client side

* move chain + network to event -> working chain activity dashboard

* switch ce commands to ts-node-dev

* chain + network added to event in ChainEventConsumer

* save

* filter out non entity creation/completion events for notifications

* remove EventTypeCUD RabbitMQ types + config + pub/sub calls

* remove ChainEventType model

* remove chain-event-type migration

* CET model removal fixes

* CW remove CET migration

* CW remove CET model

* CET removal migrations + model update

* migration fixes

* migration fixes

* chain subscriptions + chain-event notification settings + subscribedChains

* add full chain to createSubscription route result + fix UI

* turn off sourceMap, use proper tsconfig when building ce, and fixed scraper imports

* add type check to CI + fix type errors

* add type check to CI + fix type errors + remove format in CE repo

* set allowJs: false in tsconfig so sourceMap files don't interrupt ts-node

* RabbitMQ merge fixes

* Make CI lint only the changes in the branch rather than everything

* fix tsconfig + run prettier

* merge fixes

* merge fixes

* discoverReconnectRange fix

* consumer erc20 notification handler bug fix

* load-env-var fix

* Procfile fix

* master merge fixes

* fix chain-event notifications

* fix chain-event email notifications

* format

* format

* CE css fix

* remove subscriptions count for chain-events

* fix getSubscribedChains call

* notification settings page fixes + remove unnecessary logs

* format

* delete script

* migration script fix

* prettier format

* publishCustomRabbitMQMessage.ts improvements

* prettier format

* more script improvements for testing/QA

* add dump file to gitignore

* 8 min local

* 15 seconds local

* add fkey from NR to Sub

* format

* eslint + format + .prettierignore update

* Ensure CET Removal Backwards Compatibility. (#2765)

* Use CE proxy for events too.

* Ensure backwards compatibility for deployment + fix link to chain.

* Prettier fixes.

* Remove log.

* fixed type errors

* fix lint

* fix lint

* format

* small logging fix

* migration log improvement

* ce procfile fix

* add missing index to notif table

* Subscriptions pkey + not null

* fix type

* test improved CE queries

* Procfile fix

* heroku test

* heroku test 2

* cleaup

* redo migration

* redo migration CE + network migration fix

* fix order of CE migrations

* logging for debugging 503

* error handling CE - 503 debugging

* event route - 503 debugging

* optimize event route db query

* prettier

---------

Co-authored-by: Jake Naviasky <jake@commonwealth.im>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Muon Shot <120686579+CowMuon@users.noreply.github.com>

(cherry picked from commit 6632d14)

* merge CET removal fixes

* add key to divs in notification settings

* redraw -> forceRerender

* standardized

* Fix proposals page for contracts.

---------

Co-authored-by: Jake Naviasky <jake@commonwealth.im>
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.

Remove ChainEventTypes
3 participants