-
Notifications
You must be signed in to change notification settings - Fork 506
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
[update] modify the RefreshAgents interface to use batch operations; #922
base: master
Are you sure you want to change the base?
Conversation
zfchai
commented
Mar 7, 2025
- Add batch method
- BulkInsertAgentsAsync
- BulkInsertUserAgentsAsync
- DeleteAgentsAsync
- DeleteAgentsAsync(List agentIds)
- BulkInsertAgentTasksAsync
- Update method
- RefreshAgents
} | ||
catch (Exception ex) | ||
{ | ||
_logger.LogError($"Failed to migrate agent in file directory: {dir}\r\nError: {ex.Message}"); | ||
} | ||
} | ||
|
||
if (!refreshedAgents.IsNullOrEmpty()) | ||
if (agents.Count > 0) |
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.
Please ensure that when performing batch operations, the data operations are carried out within a single transaction in MongoDB to prevent other agents from failing to insert when one agent insertion encounters an exception.
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.
- IsNullOrEmpty is a built-in extension method.
- Okay, batch operations can adjust transaction support.
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.
The IBotSharpRepository currently does not provide transaction session objects.
If you consider multiple database support, this session object may not be compatible.
Thanks for you contribution! |