-
Notifications
You must be signed in to change notification settings - Fork 0
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
Homework 6 #6
base: main
Are you sure you want to change the base?
Homework 6 #6
Conversation
Add [FromQuery] and fix structure
{ | ||
using (var connection = new SQLiteConnection(ConnectionString)) | ||
{ | ||
return connection.QuerySingle<CpuMetric>("SELECT * FROM cpumetrics ORDER BY id DESC LIMIT 1"); |
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.
На пустой базе запрос будет падать.
{ | ||
using (var connection = new SQLiteConnection(ConnectionString)) | ||
{ | ||
return connection.QuerySingle<CpuMetric>("SELECT * FROM cpumetrics ORDER BY id DESC LIMIT 1"); |
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.
На пустой базе запрос падает. Разумеется метрики не собираются
public Task Execute(IJobExecutionContext context) | ||
{ | ||
IList<AgentInfo> agents = _agentRepository.GetAll(); | ||
var last = _UNIX.AddSeconds(_metricRepository.GetLast().Time.TotalSeconds); |
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.
опять эта ненужная константа _UNIX. Выпилить ее везде и переписать с использованием существующих методов Net Cor (DateTimeOffset.UnixEpoch)
|
||
for (int i = 0; i < agents.Count; i++) | ||
{ | ||
var temp = new GetAllCpuMetricsApiRequest(); |
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.
temp это что такое? температура? Я уже и на лекциях и в ревью много раз замечал что именования очень важны. Назовите нормально, пожалуйста, исходя из того что за сущность вы тут создаете
public Task Execute(IJobExecutionContext context) | ||
{ | ||
IList<AgentInfo> agents = _agentRepository.GetAll(); | ||
var last = _UNIX.AddSeconds(_metricRepository.GetLast().Time.TotalSeconds); |
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.
это работать не будет. Last надо получать не вообще, а для каждого агента СВОЙ.
No description provided.