Commit 0b0fd220 authored by David Haynes's avatar David Haynes 🙆
Browse files

Merge branch '2.2-dev' of git.gmu.edu:srct/go into 2.2-dev

parents 409d57cd b0293d82
Pipeline #1254 passed with stage
in 1 minute and 22 seconds
...@@ -134,14 +134,13 @@ class URL(models.Model): ...@@ -134,14 +134,13 @@ class URL(models.Model):
""" """
if cache.get("hashids_counter") is None: if cache.get("hashids_counter") is None:
cache.set("hashids_counter", URL.objects.count()) cache.set("hashids_counter", URL.objects.count())
cache.incr("hashids_counter")
short = HASHIDS.encrypt(cache.get("hashids_counter"))
tries = 1 tries = 1
while tries < 100: while tries < 100:
try: try:
URL.objects.get(short__iexact=short) short = HASHIDS.encrypt(cache.get("hashids_counter"))
tries += 1 tries += 1
cache.incr("hashids_counter") cache.incr("hashids_counter")
URL.objects.get(short__iexact=short)
except URL.DoesNotExist as ex: except URL.DoesNotExist as ex:
print(ex) print(ex)
return short return short
......
...@@ -103,7 +103,7 @@ SRCT Go &bull; About ...@@ -103,7 +103,7 @@ SRCT Go &bull; About
<br></br> <br></br>
Go 1.0: Go 1.0:
<br /> <br />
<a href="https://github.com/jrouly">Michel Rouley</a>, <a href="https://github.com/jrouly">Michel Rouly</a>,
<a href="https://github.com/creffett">Chris Reffett</a>, <a href="https://github.com/creffett">Chris Reffett</a>,
<a href="https://github.com/nanderson94">Nicholas Anderson</a>, <a href="https://github.com/nanderson94">Nicholas Anderson</a>,
and <a href="https://github.com/akshaykarthik">Akshay Karthik</a>. and <a href="https://github.com/akshaykarthik">Akshay Karthik</a>.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment