Skip to content

Conversation

@mpretty-cyro
Copy link
Collaborator

@mpretty-cyro mpretty-cyro commented Aug 29, 2025

  • Refactored the JobRunner to be an actor and use async/await
  • Refactored the JobQueue to be an actor and use async/await
  • Removed ThreadSafe logic from both
  • Removed the uniqueHashValue from Job
    • Add a migration to drop the column
    • Make the shouldBeUnique behaviour part of the DisplayPictureDownloadJob (since it's only used for that one job)
  • Refactor jobs to conform to the new JobExecuter structure (a number of these will need further refactoring to be fully async/await)
    • AttachmentDownloadJob
    • AttachmentUploadJob
    • CheckForAppUpdatesJob
    • ConfigMessageReceiveJob
    • ConfigurationSyncJob
    • DisappearingMessagesJob
    • DisplayPictureDownloadJob
    • ExpirationUpdateJob
    • FailedAttachmentDownloadsJob
    • FailedGroupInvitesAndPromotionsJob
    • FailedMessageSendsJob
    • GarbageCollectionJob
    • GetExpirationJob
    • GroupInviteMemberJob
    • GroupLeavingJob
    • GroupPromoteMemberJob
    • MessageReceiveJob
    • MessageSendJob
    • ProcessPendingGroupMemberRemovalsJob
    • RetrieveDefaultOpenGroupRoomsJob
    • SendReadReceiptsJob
    • SyncPushTokensJob
    • UpdateProfilePictureJob
  • Test that the jobs are actually still working with the above changes
  • Fix the unit tests

• Refactored the JobRunner
• Refactored the JobQueue
• Refactored the FailedAttachmentDownloadsJob to be async/await
• Refactored the FailedMessageSendsJob to be async/await
• Removed the `uniqueHashValue` from `Job` (make the `shouldBeUnique` behaviour part of the `DisplayPictureDownloadJob` instead)
@mpretty-cyro mpretty-cyro self-assigned this Aug 29, 2025
…efactor

# Conflicts:
#	Session.xcodeproj/project.pbxproj
#	Session/Settings/NukeDataModal.swift
#	SessionMessagingKit/Jobs/AttachmentDownloadJob.swift
#	SessionMessagingKit/Jobs/AttachmentUploadJob.swift
#	SessionMessagingKit/Jobs/CheckForAppUpdatesJob.swift
#	SessionMessagingKit/Jobs/ConfigurationSyncJob.swift
#	SessionMessagingKit/Jobs/DisplayPictureDownloadJob.swift
#	SessionMessagingKit/Jobs/ExpirationUpdateJob.swift
#	SessionMessagingKit/Jobs/GroupInviteMemberJob.swift
#	SessionMessagingKit/Jobs/MessageReceiveJob.swift
#	SessionMessagingKit/Jobs/SendReadReceiptsJob.swift
#	SessionMessagingKit/Jobs/UpdateProfilePictureJob.swift
#	SessionMessagingKit/Utilities/Profile+CurrentUser.swift
#	SessionUtilitiesKit/JobRunner/JobRunner.swift
#	SessionUtilitiesKit/Types/CurrentValueAsyncStream.swift
• Updated `waitUntilInitialised` to have fallback support for iOS 15
• Updated the JobExecutor to allow individual jobs to control their concurrent execution behaviour
• Fixed some race conditions in the JobRunner
• Fixed some issues with concurrent job running
• Fixed some issues where jobs would initialise a Noop version of libSession which could break the users state during this app run
• Updated the code to set the `JobPriorityContext` when entering/leaving a conversation
• Updated the MessageReceiveJob to split failed messages into a separate job (keeps the behaviours and logs more consistent)
• Updated the Onboarding code to use async/await instead of publishers
• Updated the BackgroundPoller to handle the async/await Poller changes
• Fixed a couple of issues with the file download sorting
• Fixed an issue when setting the file sort data retriever
• Fixed an issue where "initial job dependencies" provided when adding a job to the job runner weren't saved to the database
• Fixed a few issues where jobs could fail or behave strangely on startup because they were racing initial data loading
• Fixed an issue where the home and conversation screens would try to trigger layouts while the app was doing background fetches
• Added a timeout to the background message sending logic
• Updated the logic to allow starting specific job variants during the background period (so dependant jobs work)
• Updated the job filtering logic to allow OR based filters within a category (eg. select jobs where "RUNNING" AND ("messageSend" OR "attachmentUpload")
@mpretty-cyro mpretty-cyro changed the title [WIP] Refactor the JobRunner to use actors and be async/await Refactor the JobRunner to use actors and be async/await Jan 27, 2026
@mpretty-cyro mpretty-cyro added enhancement New feature or request Jira This ticket is being tracked in Jira labels Jan 27, 2026
@mpretty-cyro mpretty-cyro requested a review from RyanRory January 27, 2026 21:38
@mpretty-cyro mpretty-cyro marked this pull request as ready for review January 27, 2026 21:38
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove this migration?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove this migration?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove this migration?

• Made some optimisations to the logging logic
• Updated a bunch of group update functions to be async/await
• Updated code to use `decodedMessage.sender` everywhere instead of `message.sender` (where available)
• Fixed an issue where we would pointlessly try to mutate the contacts config when updating the current users profile info
• Fixed an issue where onboarding could fail to save the user to the database due to a query trying to update a non-existent config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request Jira This ticket is being tracked in Jira

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants