Skip to content

Django q - #1398

Merged
SchrodingersGat merged 102 commits into
inventree:masterfrom
SchrodingersGat:django-q
Apr 11, 2021
Merged

SchrodingersGat merged 102 commits into
inventree:masterfrom
SchrodingersGat:django-q

Conversation

@SchrodingersGat

@SchrodingersGat SchrodingersGat commented Mar 11, 2021 •

Copy link
Copy Markdown
Member

@SchrodingersGat SchrodingersGat self-assigned this Mar 11, 2021
@SchrodingersGat SchrodingersGat added the enhancement This is an suggested enhancement or new feature label Mar 11, 2021
Comment thread InvenTree/InvenTree/version.py Outdated
return [int(g) for g in match.groups()]


def versionTupleToInt(version):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can compare version tuples directly.

(2,4,1) < (2,4,2): True
(3) > (2,4,2): True

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh, you learn something new every day. I did not know Python could do that!

now = datetime.now()
past = now - timedelta(minutes=10)

results = Success.objects.filter(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would just delete any heart beat other than the last one while I'm in this code.


clusters = Stat.get_all()

if len(clusters) > 0:

@rcludwick rcludwick Mar 14, 2021 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if clusters:
return True

Since it's more pythonic.

Or if stat.get_all(): return True


all_healthy = True

for k in status.keys():

@rcludwick rcludwick Mar 16, 2021 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all_healthy = all([v for v in status.values()])

@rcludwick

Copy link
Copy Markdown
Contributor

I tend to say yes for simplicity with dealing with the media/statics, but you could also just make life easier for yourself and just provide a configuration for a docker-compose with nginx sitting in front of it.

@SchrodingersGat

Copy link
Copy Markdown
Member Author

@rcludwick I think this is ready for a test drive now. Please let me know if you can get it working on your end, and if there's anything else I should add, before it goes live on dockerhub

@SchrodingersGat
SchrodingersGat merged commit a2ff3e3 into inventree:master Apr 11, 2021
@SchrodingersGat
SchrodingersGat deleted the django-q branch April 11, 2021 05:38
@rcludwick

Copy link
Copy Markdown
Contributor

Apologies, I didn't get a chance this weekend to look at it this weekend. I can't wait to try it out on my "production" server at home.

If I see anything wrong, I'll just file issues/PR's.

🎉

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

Labels

enhancement This is an suggested enhancement or new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Investigate implementation of "background tasks"

2 participants