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:
@@ -0,0 +1,43 @@
|
||||
class Internal::RemoveStaleContactInboxesService
|
||||
def perform
|
||||
return unless remove_stale_contact_inbox_job_enabled?
|
||||
|
||||
time_period = 90.days.ago
|
||||
contact_inboxes_to_delete = stale_contact_inboxes(time_period)
|
||||
|
||||
log_stale_contact_inboxes_deletion(contact_inboxes_to_delete, time_period)
|
||||
|
||||
# Since the number of records to delete is very high,
|
||||
# delete_all would be faster than destroy_all since it operates at database level
|
||||
# and avoid loading all the records in memory
|
||||
# Transaction and batching is used to avoid deadlock and memory issues
|
||||
ContactInbox.transaction do
|
||||
contact_inboxes_to_delete
|
||||
.find_in_batches(batch_size: 10_000) do |group|
|
||||
ContactInbox.where(id: group.map(&:id)).delete_all
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def remove_stale_contact_inbox_job_enabled?
|
||||
job_status = ENV.fetch('REMOVE_STALE_CONTACT_INBOX_JOB_STATUS', false)
|
||||
return false unless ActiveModel::Type::Boolean.new.cast(job_status)
|
||||
|
||||
true
|
||||
end
|
||||
|
||||
def stale_contact_inboxes(time_period)
|
||||
ContactInbox.stale_without_conversations(time_period)
|
||||
end
|
||||
|
||||
def log_stale_contact_inboxes_deletion(contact_inboxes, time_period)
|
||||
count = contact_inboxes.count
|
||||
Rails.logger.info "Deleting #{count} stale contact inboxes older than #{time_period}"
|
||||
|
||||
# Log the SQL query without executing it
|
||||
sql_query = contact_inboxes.to_sql
|
||||
Rails.logger.info("SQL Query: #{sql_query}")
|
||||
end
|
||||
end
|
||||
19
app/services/internal/remove_stale_contacts_service.rb
Normal file
19
app/services/internal/remove_stale_contacts_service.rb
Normal file
@@ -0,0 +1,19 @@
|
||||
class Internal::RemoveStaleContactsService
|
||||
pattr_initialize [:account!]
|
||||
|
||||
def perform(batch_size = 1000)
|
||||
contacts_to_remove = @account.contacts.stale_without_conversations(30.days.ago)
|
||||
total_deleted = 0
|
||||
|
||||
Rails.logger.info "[Internal::RemoveStaleContactsService] Starting removal of stale contacts for account #{@account.id}"
|
||||
|
||||
contacts_to_remove.find_in_batches(batch_size: batch_size) do |batch|
|
||||
contact_ids = batch.map(&:id)
|
||||
|
||||
ContactInbox.where(contact_id: contact_ids).delete_all
|
||||
Contact.where(id: contact_ids).delete_all
|
||||
total_deleted += batch.size
|
||||
Rails.logger.info "[Internal::RemoveStaleContactsService] Deleted #{batch.size} contacts (#{total_deleted} total) for account #{@account.id}"
|
||||
end
|
||||
end
|
||||
end
|
||||
15
app/services/internal/remove_stale_redis_keys_service.rb
Normal file
15
app/services/internal/remove_stale_redis_keys_service.rb
Normal file
@@ -0,0 +1,15 @@
|
||||
class Internal::RemoveStaleRedisKeysService
|
||||
pattr_initialize [:account_id!]
|
||||
|
||||
def perform
|
||||
Rails.logger.info "Removing redis stale keys for account #{@account_id}"
|
||||
range_start = (Time.zone.now - OnlineStatusTracker::PRESENCE_DURATION).to_i
|
||||
# exclusive minimum score is specified by prefixing (
|
||||
# we are clearing old records because this could clogg up the sorted set
|
||||
::Redis::Alfred.zremrangebyscore(
|
||||
OnlineStatusTracker.presence_key(@account_id, 'Contact'),
|
||||
'-inf',
|
||||
"(#{range_start}"
|
||||
)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user