Initial commit: Add logistics and order_detail message types
Some checks failed
Lock Threads / action (push) Has been cancelled
Mark stale issues and pull requests / stale (push) Has been cancelled
Publish Chatwoot EE docker images / build (linux/amd64, ubuntu-latest) (push) Has been cancelled
Publish Chatwoot EE docker images / build (linux/arm64, ubuntu-22.04-arm) (push) Has been cancelled
Publish Chatwoot EE docker images / merge (push) Has been cancelled
Publish Chatwoot CE docker images / build (linux/amd64, ubuntu-latest) (push) Has been cancelled
Publish Chatwoot CE docker images / build (linux/arm64, ubuntu-22.04-arm) (push) Has been cancelled
Publish Chatwoot CE docker images / merge (push) Has been cancelled
Run Chatwoot CE spec / lint-backend (push) Has been cancelled
Run Chatwoot CE spec / lint-frontend (push) Has been cancelled
Run Chatwoot CE spec / frontend-tests (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (0, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (1, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (10, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (11, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (12, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (13, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (14, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (15, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (2, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (3, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (4, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (5, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (6, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (7, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (8, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (9, 16) (push) Has been cancelled
Run Linux nightly installer / nightly (push) Has been cancelled
Some checks failed
Lock Threads / action (push) Has been cancelled
Mark stale issues and pull requests / stale (push) Has been cancelled
Publish Chatwoot EE docker images / build (linux/amd64, ubuntu-latest) (push) Has been cancelled
Publish Chatwoot EE docker images / build (linux/arm64, ubuntu-22.04-arm) (push) Has been cancelled
Publish Chatwoot EE docker images / merge (push) Has been cancelled
Publish Chatwoot CE docker images / build (linux/amd64, ubuntu-latest) (push) Has been cancelled
Publish Chatwoot CE docker images / build (linux/arm64, ubuntu-22.04-arm) (push) Has been cancelled
Publish Chatwoot CE docker images / merge (push) Has been cancelled
Run Chatwoot CE spec / lint-backend (push) Has been cancelled
Run Chatwoot CE spec / lint-frontend (push) Has been cancelled
Run Chatwoot CE spec / frontend-tests (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (0, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (1, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (10, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (11, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (12, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (13, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (14, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (15, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (2, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (3, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (4, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (5, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (6, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (7, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (8, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (9, 16) (push) Has been cancelled
Run Linux nightly installer / nightly (push) Has been cancelled
- Add Logistics component with progress tracking - Add OrderDetail component for order information - Support data-driven steps and actions - Add blue color scale to widget SCSS - Fix node overflow and progress bar rendering issues - Add English translations for dashboard components Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
20
app/jobs/internal/check_new_versions_job.rb
Normal file
20
app/jobs/internal/check_new_versions_job.rb
Normal file
@@ -0,0 +1,20 @@
|
||||
class Internal::CheckNewVersionsJob < ApplicationJob
|
||||
queue_as :scheduled_jobs
|
||||
|
||||
def perform
|
||||
return unless Rails.env.production?
|
||||
|
||||
@instance_info = ChatwootHub.sync_with_hub
|
||||
update_version_info
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def update_version_info
|
||||
return if @instance_info['version'].blank?
|
||||
|
||||
::Redis::Alfred.set(::Redis::Alfred::LATEST_CHATWOOT_VERSION, @instance_info['version'])
|
||||
end
|
||||
end
|
||||
|
||||
Internal::CheckNewVersionsJob.prepend_mod_with('Internal::CheckNewVersionsJob')
|
||||
27
app/jobs/internal/delete_accounts_job.rb
Normal file
27
app/jobs/internal/delete_accounts_job.rb
Normal file
@@ -0,0 +1,27 @@
|
||||
class Internal::DeleteAccountsJob < ApplicationJob
|
||||
queue_as :scheduled_jobs
|
||||
|
||||
def perform
|
||||
delete_expired_accounts
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def delete_expired_accounts
|
||||
accounts_pending_deletion.each do |account|
|
||||
AccountDeletionService.new(account: account).perform
|
||||
end
|
||||
end
|
||||
|
||||
def accounts_pending_deletion
|
||||
Account.where("custom_attributes->>'marked_for_deletion_at' IS NOT NULL")
|
||||
.select { |account| deletion_period_expired?(account) }
|
||||
end
|
||||
|
||||
def deletion_period_expired?(account)
|
||||
deletion_time = account.custom_attributes['marked_for_deletion_at']
|
||||
return false if deletion_time.blank?
|
||||
|
||||
DateTime.parse(deletion_time) <= Time.current
|
||||
end
|
||||
end
|
||||
39
app/jobs/internal/process_stale_contacts_job.rb
Normal file
39
app/jobs/internal/process_stale_contacts_job.rb
Normal file
@@ -0,0 +1,39 @@
|
||||
# housekeeping
|
||||
# remove stale contacts for subset of accounts each day
|
||||
# - have no identification (email, phone_number, and identifier are NULL)
|
||||
# - have no conversations
|
||||
# - are older than 30 days
|
||||
|
||||
class Internal::ProcessStaleContactsJob < ApplicationJob
|
||||
queue_as :housekeeping
|
||||
|
||||
# Number of day-based groups to split accounts into
|
||||
DISTRIBUTION_GROUPS = 5
|
||||
# Max accounts to process in one batch
|
||||
MAX_ACCOUNTS_PER_BATCH = 20
|
||||
|
||||
# Process only a subset of accounts per day to avoid flooding the queue
|
||||
def perform
|
||||
return unless ChatwootApp.chatwoot_cloud?
|
||||
|
||||
# Use the day of the month to determine which accounts to process
|
||||
day_of_month = Date.current.day
|
||||
remainder = day_of_month % DISTRIBUTION_GROUPS
|
||||
|
||||
# Count total accounts for logging
|
||||
total_accounts = Account.count
|
||||
log_message = "ProcessStaleContactsJob: Processing accounts with ID % #{DISTRIBUTION_GROUPS} = "
|
||||
log_message += "#{remainder} (out of #{total_accounts} total accounts)"
|
||||
Rails.logger.info log_message
|
||||
|
||||
# Process only accounts where ID % 5 = remainder for today
|
||||
# This ensures each account is processed approximately once every 5 days
|
||||
Account.where("id % #{DISTRIBUTION_GROUPS} = ?", remainder).find_each(batch_size: MAX_ACCOUNTS_PER_BATCH) do |account|
|
||||
Rails.logger.info "Enqueuing RemoveStaleContactsJob for account #{account.id}"
|
||||
|
||||
# Add a small delay between jobs to further reduce queue pressure
|
||||
delay = rand(1..10).minutes
|
||||
Internal::RemoveStaleContactsJob.set(wait: delay).perform_later(account)
|
||||
end
|
||||
end
|
||||
end
|
||||
12
app/jobs/internal/process_stale_redis_keys_job.rb
Normal file
12
app/jobs/internal/process_stale_redis_keys_job.rb
Normal file
@@ -0,0 +1,12 @@
|
||||
# housekeeping
|
||||
# remove contact inboxes that does not have any conversations
|
||||
# and are older than 3 months
|
||||
|
||||
class Internal::ProcessStaleRedisKeysJob < ApplicationJob
|
||||
queue_as :low
|
||||
|
||||
def perform(account)
|
||||
removed_count = Internal::RemoveStaleRedisKeysService.new(account_id: account.id).perform
|
||||
Rails.logger.info "Successfully cleaned up Redis keys for account #{account.id} (removed #{removed_count} keys)"
|
||||
end
|
||||
end
|
||||
11
app/jobs/internal/remove_stale_contact_inboxes_job.rb
Normal file
11
app/jobs/internal/remove_stale_contact_inboxes_job.rb
Normal file
@@ -0,0 +1,11 @@
|
||||
# housekeeping
|
||||
# remove contact inboxes that does not have any conversations
|
||||
# and are older than 3 months
|
||||
|
||||
class Internal::RemoveStaleContactInboxesJob < ApplicationJob
|
||||
queue_as :scheduled_jobs
|
||||
|
||||
def perform
|
||||
Internal::RemoveStaleContactInboxesService.new.perform
|
||||
end
|
||||
end
|
||||
13
app/jobs/internal/remove_stale_contacts_job.rb
Normal file
13
app/jobs/internal/remove_stale_contacts_job.rb
Normal file
@@ -0,0 +1,13 @@
|
||||
# housekeeping
|
||||
# remove contacts that:
|
||||
# - have no identification (email, phone_number, and identifier are NULL)
|
||||
# - have no conversations
|
||||
# - are older than 30 days
|
||||
|
||||
class Internal::RemoveStaleContactsJob < ApplicationJob
|
||||
queue_as :housekeeping
|
||||
|
||||
def perform(account, batch_size = 1000)
|
||||
Internal::RemoveStaleContactsService.new(account: account).perform(batch_size)
|
||||
end
|
||||
end
|
||||
16
app/jobs/internal/remove_stale_redis_keys_job.rb
Normal file
16
app/jobs/internal/remove_stale_redis_keys_job.rb
Normal file
@@ -0,0 +1,16 @@
|
||||
# housekeeping
|
||||
# ensure stale ONLINE PRESENCE KEYS for contacts are removed periodically
|
||||
# should result in 50% redis mem size reduction
|
||||
|
||||
class Internal::RemoveStaleRedisKeysJob < ApplicationJob
|
||||
queue_as :scheduled_jobs
|
||||
|
||||
def perform
|
||||
Account.find_in_batches(batch_size: 100) do |accounts|
|
||||
accounts.each do |account|
|
||||
Rails.logger.info "Enqueuing ProcessStaleRedisKeysJob for account #{account.id}"
|
||||
Internal::ProcessStaleRedisKeysJob.perform_later(account)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
7
app/jobs/internal/seed_account_job.rb
Normal file
7
app/jobs/internal/seed_account_job.rb
Normal file
@@ -0,0 +1,7 @@
|
||||
class Internal::SeedAccountJob < ApplicationJob
|
||||
queue_as :low
|
||||
|
||||
def perform(account)
|
||||
Seeders::AccountSeeder.new(account: account).perform!
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user