Class: Gitlab::Graphql::Subscriptions::ActionCableWithLoadBalancing
- Inherits:
-
GraphQL::Subscriptions::ActionCableSubscriptions
- Object
- GraphQL::Subscriptions::ActionCableSubscriptions
- Gitlab::Graphql::Subscriptions::ActionCableWithLoadBalancing
- Extended by:
- Utils::Override
- Defined in:
- lib/gitlab/graphql/subscriptions/action_cable_with_load_balancing.rb
Constant Summary collapse
- KEY_PAYLOAD =
'gql_payload'
- KEY_WAL_LOCATIONS =
'wal_locations'
Instance Method Summary collapse
Methods included from Utils::Override
extended, extensions, included, method_added, override, prepended, queue_verification, verify!
Methods included from Database::LoadBalancing::WalTrackingReceiver
Methods included from Database::LoadBalancing::WalTrackingSender
#wal_location_for, #wal_location_source, #wal_location_sources_by_db_name, #wal_locations_by_db_name
Instance Method Details
#execute_all(event, object) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/gitlab/graphql/subscriptions/action_cable_with_load_balancing.rb', line 15 def execute_all(event, object) super(event, { KEY_WAL_LOCATIONS => current_wal_locations, KEY_PAYLOAD => object }) end |
#execute_update(subscription_id, event, object) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/gitlab/graphql/subscriptions/action_cable_with_load_balancing.rb', line 24 def execute_update(subscription_id, event, object) # Make sure we do not accidentally try to unwrap messages that are not wrapped. # This could in theory happen if workers roll over where some send wrapped payload # and others expect the original payload. return super(subscription_id, event, object) unless wrapped_payload?(object) if use_primary?(object[KEY_WAL_LOCATIONS]) ::Gitlab::Database::LoadBalancing::SessionMap .with_sessions(Gitlab::Database::LoadBalancing.base_models) .use_primary! end super(subscription_id, event, object[KEY_PAYLOAD]) end |