@@ -1929,13 +1929,16 @@ func InsertWorkspaceResource(ctx context.Context, db database.Store, jobID uuid.
1929
1929
1930
1930
if prAgent .ResourcesMonitoring != nil {
1931
1931
if prAgent .ResourcesMonitoring .Memory != nil {
1932
- db .InsertWorkspaceAgentResourceMonitor (ctx , database.InsertWorkspaceAgentResourceMonitorParams {
1932
+ _ , err = db .InsertWorkspaceAgentResourceMonitor (ctx , database.InsertWorkspaceAgentResourceMonitorParams {
1933
1933
AgentID : agentID ,
1934
1934
Rtype : database .WorkspaceAgentMonitoredResourceTypeMemory ,
1935
1935
Enabled : prAgent .ResourcesMonitoring .Memory .Enabled ,
1936
1936
Threshold : prAgent .ResourcesMonitoring .Memory .Threshold ,
1937
1937
CreatedAt : dbtime .Now (),
1938
1938
})
1939
+ if err != nil {
1940
+ return xerrors .Errorf ("insert agent resource monitor: %w" , err )
1941
+ }
1939
1942
}
1940
1943
1941
1944
for volume , monitor := range prAgent .ResourcesMonitoring .Volumes {
@@ -1946,14 +1949,17 @@ func InsertWorkspaceResource(ctx context.Context, db database.Store, jobID uuid.
1946
1949
return xerrors .Errorf ("marshal metadata: %w" , err )
1947
1950
}
1948
1951
1949
- db .InsertWorkspaceAgentResourceMonitor (ctx , database.InsertWorkspaceAgentResourceMonitorParams {
1952
+ _ , err = db .InsertWorkspaceAgentResourceMonitor (ctx , database.InsertWorkspaceAgentResourceMonitorParams {
1950
1953
AgentID : agentID ,
1951
1954
Rtype : database .WorkspaceAgentMonitoredResourceTypeVolume ,
1952
1955
Enabled : monitor .Enabled ,
1953
1956
Threshold : monitor .Threshold ,
1954
1957
Metadata : marshaledMetadata ,
1955
1958
CreatedAt : dbtime .Now (),
1956
1959
})
1960
+ if err != nil {
1961
+ return xerrors .Errorf ("insert agent resource monitor: %w" , err )
1962
+ }
1957
1963
}
1958
1964
}
1959
1965
0 commit comments