-
Notifications
You must be signed in to change notification settings - Fork 24
feat: introduce WorkAgent - WPB-20123 #3800
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Test Results 2 files 126 suites 23s ⏱️ Results for commit a856182. ♻️ This comment has been updated with latest results. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
left a couple comments.
question: why was it added on SyncEngine rather than WireDomain? It would be easier also for integration to initialize on ClientSessionComponent
WireDomain/Sources/WireDomain/WorkAgent/WorkTicket/WorkTicketPriority.swift
Outdated
Show resolved
Hide resolved
@netbe I thought maybe it would make sense to keep it closer to the user session but happy to move it to WireDomain. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving because I think this is needed soon but I have some questions that perhaps will be covered in tomorrow's meeting:
- Currently I don't quite understand where the actually work to be done is contained? I think I need to see an example with real work.
- Related to above, when reviewing I was kind of wondering is a ticket like a
DispatchWorkItem? In the case of a DispatchWorkItem, the work to be done is defined in the item.. But now I'm thinking is the work to be done defined in theWorker? And perhaps a ticket provides information needed to perform the work such as userID? It would be good to see the names of a few possible Workers to understand this better.
WireDomain/Sources/WireDomain/WorkAgent/WorkScheduler/PriorityOrderWorkScheduler.swift
Outdated
Show resolved
Hide resolved
@samwyndham yes you understand right, the work is to be done inside the Another example could be a The idea is that workers know what kind of work they need to do... they are autonomous in this regard, and will raise tickets whenever they want to perform work. But they wait for their ticket to be called in order to proceed with the work. This allows us to keep the work in the workers who have context, while the management and scheduling of the work is done elsewhere that doesn't need to know about the work being done (aside from provided metadata such as priority and requirements like network etc). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work. I left a question/thought
89e0cdf to
87a55b8
Compare
Issue
There is a need to perform tasks asynchronously and automatically, such as fetching conversation metadata for conversations marked as stale, or sending pending messages.
This PR introduces the
WorkAgentas a system to generate, schedule, and perform work autonomously. Its design is modeled after ticketing systems common in public places such as banks and town halls where people generate a ticket with a computer system and wait for their ticket to be called. The system will schedule tickets according to priority and available resources and call people when their ticket is ready, who are then able to receive the service they have requested.The system introduced here works in a similar way:
WorkAgentis a central object that coordinatesWorkers,WorkTickets, and aWorkScheduler.Workers generate tickets and submit them to theWorkAgent.This is a simple an initial implementation to get started, but there are a variety of enhancements that we can make, such as:
Testing
The system is not integrated yet.
Checklist
[WPB-XXX].UI accessibility checklist
If your PR includes UI changes, please utilize this checklist: