fix: reconnecting deadlock (#66)
* fix: fill whatsapp provider url with value from inbox provider config * chore: compact blank on setup channel provider * fix: deadlock on `reconnecting` state
This commit is contained in:
parent
6e1da287a2
commit
b7a316fafa
@ -48,7 +48,10 @@ onMounted(() => {
|
||||
}
|
||||
});
|
||||
onUnmounted(() => {
|
||||
if (connection.value === 'connecting') {
|
||||
if (
|
||||
connection.value === 'connecting' ||
|
||||
connection.value === 'reconnecting'
|
||||
) {
|
||||
disconnect();
|
||||
}
|
||||
});
|
||||
|
||||
@ -61,6 +61,7 @@ export default {
|
||||
methods: {
|
||||
setDefaults() {
|
||||
this.hmacMandatory = this.inbox.hmac_mandatory || false;
|
||||
this.whatsAppProviderUrl = this.inbox.provider_config?.provider_url ?? '';
|
||||
this.markAsRead = this.inbox.provider_config.mark_as_read ?? true;
|
||||
},
|
||||
handleHmacFlag() {
|
||||
|
||||
@ -107,8 +107,13 @@ class Channel::Whatsapp < ApplicationRecord
|
||||
provider_service.unread_message(conversation.contact.phone_number, last_message) if last_message
|
||||
end
|
||||
|
||||
def disconnect_channel_provider
|
||||
provider_service.disconnect_channel_provider
|
||||
ensure
|
||||
update_provider_connection!(connection: 'close')
|
||||
end
|
||||
|
||||
delegate :setup_channel_provider, to: :provider_service
|
||||
delegate :disconnect_channel_provider, to: :provider_service
|
||||
delegate :send_message, to: :provider_service
|
||||
delegate :send_template, to: :provider_service
|
||||
delegate :sync_templates, to: :provider_service
|
||||
|
||||
@ -18,7 +18,7 @@ class Whatsapp::Providers::WhatsappBaileysService < Whatsapp::Providers::BaseSer
|
||||
webhookVerifyToken: whatsapp_channel.provider_config['webhook_verify_token'],
|
||||
# TODO: Remove on Baileys v2, default will be false
|
||||
includeMedia: false
|
||||
}.compact.to_json
|
||||
}.compact_blank.to_json
|
||||
)
|
||||
|
||||
process_response(response)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user