Commit Graph

34 Commits

Author SHA1 Message Date
Shivam Mishra
abc511d00f fix: inconsistent OpenAI cache interface (#10009)
Signed-off-by: Shivam Mishra <scm.mymail@gmail.com>
Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
2024-08-22 23:04:14 +05:30
Muhsin Keloth
eb6de74269 fix: OpenAPI label suggestion response payload (#10008) 2024-08-22 15:32:33 +05:30
jderecho
0d7773d88f feat: Draft through API for Cross-Device Support (#8018)
- Add APIs for cross-device message drafts

ref: #6890
2024-05-02 18:42:18 -07:00
Sojan Jose
390cd756e8 chore: Reorganize the installation config settings (#8794)
- Reorganizing installation config settings to move more configurations into UI from environment variables
- Changes to installation config to support premium plans in the enterprise edition
- Fixes the broken premium indicator in account/show and accounts/edit page
2024-01-31 16:48:42 +04:00
Pranav Raj S
fdbb3bf4b1 fix: Optimize email fetching logic to fix bandwidth exceeded issues (#8730)
The Inboxes::FetchImapEmailsJob is designed to fetch the entire email object and check if its message id is already in the database. However, this process is resource-intensive and time-consuming, as fetching the full email object takes a significant amount of time.

On average, fetching 100 emails can take approximately 3-4 minutes to complete depending on the IMAP server. Since we are not using server flags to identify which emails have already been fetched (to avoid compatibility issues with flags in different email services), we have to fetch all previously available emails. Currently we fetch all the messages that were created from yesterday. This becomes problematic with services like Gmail, which throttle requests based on bandwidth usage.

To address this issue, I have updated the logic as follows:

Fetch the sequence IDs of all the mails in the "Inbox" that were created from yesterday.
Use the FETCH command to fetch only the message-ids using BODY.PEEK[HEADER.FIELDS (MESSAGE-ID)] with the sequence IDs we got in the previous step. This is a faster operation with lower bandwidth usage, as it only returns the sequence ID and message ID.
Check if the message IDs are already present in the database for the selected inbox.
If not present, fetch the entire email object using the FETCH command and create the message.
If the message ID is already present, ignore it and move on to the next message-id.
I have also addressed the issue of duplicate emails appearing in conversations when two fetch email jobs occur simultaneously. I have added a lock for the channel to ensure that the job gracefully exits without waiting for the current job to complete.

Fixes #7247
Fixes #6082
Fixes #8314

Co-authored-by: Sojan <sojan@pepalo.com>
2024-01-18 11:45:16 +04:00
Shivam Mishra
10076c6a3e feat: set lock timeout to 1 second (#8661) 2024-01-12 08:28:07 +05:30
Pranav Raj S
6c4b92f7f6 fix: Revert the changes for SyncCustomFilterCountJob (#8238) 2023-10-27 10:45:48 -07:00
Shivam Mishra
336584c95a feat: mutex for InstagramEventsJob [CW-2447] (#7828) 2023-09-04 15:02:13 +05:30
Shivam Mishra
2acf09b3eb refactor: use conversation_id instead of sender_id (#7831) 2023-08-31 16:10:37 +07:00
Shivam Mishra
5598b4b27e feat: implement mutex for SlackSendJob (#7783) 2023-08-25 11:58:29 +07:00
Shivam Mishra
44f6a9ec3c feat: update lock timeout and retry configuration (#7785) 2023-08-24 12:59:47 +07:00
Shivam Mishra
26ef21a243 feat: locking and retry in FB message parsing (#7701) 2023-08-23 09:48:17 +07:00
Shivam Mishra
a940f4c1d2 feat: Allow label suggestions with OpenAI APIs (#7428) 2023-07-10 14:40:54 +05:30
Tejaswini Chile
9d0de04f7c fix: set custom filter count in redis (#7164) 2023-06-19 16:10:03 +05:30
Sojan Jose
022383d942 chore: Upgrade to Rails 7 (#6719)
fixes: #6736
2023-05-06 10:44:52 +05:30
Tejaswini Chile
b081fe08b8 feat: whatsapp duplicate message (#7004) 2023-05-03 15:18:20 +05:30
Sojan Jose
8b659de73d chore: Use connection_pool for redis (#5790)
fixes: #3199
2022-11-02 17:31:20 -07:00
Nusret Ozates
10d86fbb35 chore: Ability to Remove password info from sentinel config (#4550)
Introduce the REDIS_SENTINEL_PASSWORD environment variable to customize the behaviour of sentinel passwords. 

Co-authored-by: EXT02D22861 <nusret.ozates@consultant.turkcell.com.tr>
Co-authored-by: Sojan Jose <sojan@pepalo.com>
2022-10-19 17:25:16 -07:00
Sojan Jose
8e75b3fc2a chore: Remove stale contact presence records (#5205)
fixes: chatwoot/product#493
2022-08-05 12:51:39 +02:00
Sojan Jose
8e153d6350 fix: Redis 6 on Heroku breaks ActionCable config (#4269)
Heroku made some SSL/TLS changes with Redis 6, which is breaking the ActionCable configuration.
Hence providing an environment variable configuration `REDIS_OPENSSL_VERIFY_MODE` to fix that.

set the value `none` for this environment variable in your Heroku installations where breakage occurs.

fixes: #2420
2022-03-24 19:25:07 +05:30
Sojan Jose
d7982a6ffd chore: Add assigned option to conversation finder API (#2630)
- Adds the ability to filter all the conversations which are assigned
- Add rack timeout gem
- Remove size attribute from Sidekiq config
2021-07-14 22:51:27 +05:30
Pranav Raj S
6c49e58ff8 feat: Add contact label filter (#2454)
Co-authored-by: Sojan Jose <sojan@pepalo.com>
2021-06-18 20:08:58 +05:30
Sojan Jose
42534e1df4 chore: Add fail safes for Redis connections (#2016) 2021-03-30 18:16:17 +05:30
Sojan Jose
14eefe3824 feat: Add Installation onboarding flow (#1640)
Co-authored-by: Pranav Raj S <pranav@chatwoot.com>
2021-01-17 14:07:18 +05:30
Sojan Jose
346830ab1d feat: Add Cron Jobs In Chatwoot and update installation notice (#1630) 2021-01-11 17:34:41 +05:30
Sojan Jose
a988724c91 feat: Authenticate by SSO tokens (#1439)
Co-authored-by: Pranav Raj Sreepuram <pranavrajs@gmail.com>
2020-11-25 13:59:38 +05:30
Sony Mathew
e01fdb5f00 chore: refactored redis config (sentinel related) (#1327)
Refactored the redis config module which had redis sentinel related
configs. Also changed the specs accordingly.
2020-10-09 12:37:42 +05:30
Abhishek
77d380dd6b chore: refactor redis config (#1310)
- refactor Redis config in Redis::Config Module
-  unit tests for Redis::Config module
2020-10-05 17:31:10 +05:30
Sojan Jose
b862817b29 feat: Enable reauthorization for Facebook (#1286) 2020-09-30 01:12:32 +05:30
Sojan Jose
0fc0dc1683 Chore: Refactor round robin logic (#1015)
Co-authored-by: Pranav Raj S <pranav@thoughtwoot.com>
2020-07-08 00:14:07 +05:30
Sojan Jose
c98907db49 Feature: Availability Statuses (#874)
Co-authored-by: Pranav Raj S <pranav@thoughtwoot.com>
2020-07-04 11:42:47 +05:30
Sony Mathew
d4b3ba4baa [#139] Send conversation emails (#442)
* [#139] Delayed emails for conversations

* Added the setex and get methods to Redis wrapper
* Set the priorities for the sidekiq queues
* Was not able to use mailhog for testing email in local, switched back to letter opener and added comments on using the SMTP settings
* Added after create hood in messages to queue the sending of mail after 2 minutes using sidekiq worker and also set the redis key for the conversation to avoid the email sending for every message
* Added the sidekiq worker to send the email and delete the conversation redis key
* Added the mailer and mail template
* mailer sends the last 10 messages along with the new messages from the time it was queued

* Send email only in development or if smtp config is set

* Send email only in development or if smtp config is set
* Set the SMTP_PORT in production variable

* Adding redis to circle CI

* Specs for the conversation email changes

* Added specs for conversation email sidekiq worker
* Added specs for conversation mailer
* Added specs in message model for the after create hook for notify email

* Send emails only when there is a reply from agent

* set development to use mailhog

* Adding comments for using letter opener
2020-01-23 23:14:07 +05:45
Pranav Raj S
94c6d6db6f 🚨Fix Rubocop lint errors 2019-10-20 14:17:26 +05:30
Pranav Raj Sreepuram
2a34255e0b Initial Commit
Co-authored-by: Subin <subinthattaparambil@gmail.com>
Co-authored-by: Manoj <manojmj92@gmail.com>
Co-authored-by: Nithin <webofnithin@gmail.com>
2019-08-14 15:18:44 +05:30