This commit is contained in:
@@ -45,10 +45,57 @@ OK, after some research I am doing the correct thing, it should be:
|
||||
Schema: "timestamp" Model: DateTime
|
||||
The only issue may be in the interpretation of the date time, it's sent to postgres as is so if the server converts it as local from the parameter in the route then that's waht's sent
|
||||
which is what I'm seeing in metric route so it's a translation of the datetime incoming to route parameter issue only and only when it hits the db for storage or query
|
||||
|
||||
2020-05-27 12:51:51.1443|INFO|Microsoft.EntityFrameworkCore.Database.Command|Executed DbCommand (4ms) [Parameters=[@__ToUniversalTime_0='2020-05-27T13:51:49' (DbType = DateTime),
|
||||
@__ToUniversalTime_1='2020-05-27T19:51:50' (DbType = DateTime)], CommandType='Text', CommandTimeout='30']
|
||||
SELECT a.t, a.allocated, a.cpu, a.gen0, a.gen1, a.gen2, a.privatebytes, a.workingset
|
||||
FROM ametricmm AS a
|
||||
WHERE (a.t >= @__ToUniversalTime_0) AND (a.t <= @__ToUniversalTime_1)
|
||||
ORDER BY a.t
|
||||
Ok, so the WHERE bit absolutely needs the to universal time to fixup the parameter that came in wrong
|
||||
|
||||
Storage?? I best check that shit use eventlog...
|
||||
Yes event log is properly inserting with utc time:
|
||||
2020-05-27 12:51:57.3213|INFO|Microsoft.EntityFrameworkCore.Database.Command|Executed DbCommand (10ms) [Parameters=[@p0='2', @p1='0', @p2='12', @p3='2020-05-27T19:51:56' (DbType = DateTime), @p4=NULL, @p5='1'], CommandType='Text', CommandTimeout='30']
|
||||
INSERT INTO aevent (ayevent, ayid, ayatype, created, textra, userid)
|
||||
VALUES (@p0, @p1, @p2, @p3, @p4, @p5)
|
||||
RETURNING id, xmin;
|
||||
|
||||
Ok, that's internally, but waht about a record sent in from the client?
|
||||
### Try Widget
|
||||
Posted as: {"id":0,"concurrency":0,"name":"TEST DATE FUCKERY","serial":0,"dollarAmount":123,"active":null,"userType":2,"startDate":"2020-05-27T19:20:00.000Z","endDate":"2020-05-27T20:00:00.000Z","notes":"3333","count":"333","wiki":null,"customFields":"{\"c2\":\"3333\"}","tags":[],"userId":null}
|
||||
12:20 to 1:00 pm was selected in client
|
||||
Fetched back as:
|
||||
{"data":{"id":2751,"concurrency":11535962,"name":"TEST DATE FUCKERY","serial":2751,"dollarAmount":123.0000,"active":null,"userType":2,"startDate":"2020-05-27T19:20:00Z","endDate":"2020-05-27T20:00:00Z","notes":"3333","count":333,"wiki":null,"customFields":"{\"c2\":\"3333\"}","tags":[],"userId":null}}
|
||||
so identically which is good
|
||||
Stored in DB AS:
|
||||
Start date: 2020-05-27 19:20:00 End date: 2020-05-27 20:00:00
|
||||
Ok, so a widget is utc at all aspects and is good!
|
||||
|
||||
## HOLUP
|
||||
Ok, though I had it all worked out but then I'm seeing incoming back to client the dates from metrics of this:
|
||||
2020-05-28T02:57:58.968205Z for 2020-05-27 12:57:58 Which is absolutely wrong, probably 7 hours ahead, not behind
|
||||
I must be reconverting somewhere
|
||||
Widget tests ok end to end, it's just in that metric controller fuckery
|
||||
|
||||
|
||||
|
||||
TODO: Why is this adding UTC bit to this query check the source code maybe something is up
|
||||
Schema settings mean that pg will ignore any tz specification so in theory it's ignored, but...
|
||||
|
||||
SELECT a.gid, a.xmin, a.created, a.exclusive, a.jobinfo, a.jobstatus, a.jobtype, a.name, a.objectid, a.objecttype, a.startafter, a.subtype
|
||||
FROM aopsjob AS a
|
||||
WHERE ((a.startafter < NOW() AT TIME ZONE 'UTC') AND (a.exclusive = @__exclusiveOnly_0)) AND (a.jobstatus = 1)
|
||||
ORDER BY a.created
|
||||
2020-05-27 12:51:57.2585|INFO|Microsoft.EntityFrameworkCore.Database.Command|Executed DbCommand (10ms) [Parameters=[@__exclusiveOnly_0='False'], CommandType='Text', CommandTimeout='30']
|
||||
SELECT a.gid, a.xmin, a.created, a.exclusive, a.jobinfo, a.jobstatus, a.jobtype, a.name, a.objectid, a.objecttype, a.startafter, a.subtype
|
||||
FROM aopsjob AS a
|
||||
WHERE ((a.startafter < NOW() AT TIME ZONE 'UTC') AND (a.exclusive = @__exclusiveOnly_0)) AND (a.jobstatus = 1)
|
||||
ORDER BY a.created
|
||||
|
||||
|
||||
todo: Are serial numbers working properly, I'm seeing gaps in widget but it could be because of unit testing
|
||||
|
||||
todo: leave running check it does overnight backup properly
|
||||
|
||||
todo: add backup turn off setting
|
||||
|
||||
Reference in New Issue
Block a user