Skip to content

minor changes#1

Closed
slicefox wants to merge 1 commit intovishalanandl177:masterfrom
slicefox:minor-changes
Closed

minor changes#1
slicefox wants to merge 1 commit intovishalanandl177:masterfrom
slicefox:minor-changes

Conversation

@slicefox
Copy link
Copy Markdown

@slicefox slicefox commented Oct 9, 2020

Minor changes

@vishalanandl177
Copy link
Copy Markdown
Owner

added_on = models.DateTimeField(auto_now_add=True)

We have a queue implementation to hold the logs before inserting into the database or it waits for a period of time to let the queue to be filled. If queue is full then only it inserts into the database.

So I added timezone aware datetime object in log before adding into the queue. This is the actual time of API call.

If "auto_now_add" is sets to True, It ignores the date passed explicitly to DateTimeField. You can check here https://code.djangoproject.com/ticket/16583.

If we use "auto_now_add=True" and Logs are inserted after some seconds, It will use Insertion time in "added_on" field. This will be wrong information and it is going to create a problem in debugging.

@slicefox
Copy link
Copy Markdown
Author

Yeah, I did't consider at that aspect. Current Implementation makes sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants