Skip to content

Commit d467ef4

Browse files
committed
Merge branch 'main' into rel
2 parents 97e1b87 + 2fabb1b commit d467ef4

File tree

10 files changed

+46
-21
lines changed

10 files changed

+46
-21
lines changed

CHANGELOG.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,17 @@ CHANGELOG
66
.. This is included by docs/developer/changelog.rst
77
88
9+
Version v5.29.1
10+
---------------
11+
12+
This release contained only minor changes to dependencies and logging/validation.
13+
14+
:Date: October 28, 2025
15+
16+
* @davidfischer: Adds gevent as a production option (#1090)
17+
* @davidfischer: Minor changes to logging and validation (#1089)
18+
19+
920
Version v5.29.0
1021
---------------
1122

adserver/api/serializers.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,7 @@ def validate_url(self, url):
124124
validator(url) # Throws ValidationError on invalid
125125
return url
126126
except ValidationError:
127-
log.warning("Invalid ad decision referring URL: %s", url)
128-
return None
127+
raise serializers.ValidationError("Invalid ad referring URL")
129128

130129
def validate_user_ip(self, ip):
131130
if ip and "," in ip:

adserver/api/views.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,8 +306,7 @@ def decision(self, request, data):
306306
keywords = []
307307

308308
if rotations > 1:
309-
# This is a temporary log record to see how frequently ads are rotated
310-
log.warning(
309+
log.info(
311310
"Ad rotation. rotations=%s, publisher=%s, url=%s,",
312311
rotations,
313312
publisher.slug,

adserver/tests/test_api.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1590,19 +1590,14 @@ def test_offer_url(self):
15901590
self.assertIsNotNone(offer)
15911591
self.assertEqual(offer.url, post_url)
15921592

1593-
# Invalid URL
1593+
# Invalid URL - rejected
15941594
self.data["url"] = "invalid-url"
15951595
resp = self.client.post(
15961596
self.url,
15971597
json.dumps(self.data),
15981598
content_type="application/json",
15991599
)
1600-
self.assertEqual(resp.status_code, 200, resp.content)
1601-
offer = Offer.objects.filter(id=resp.json()["nonce"]).first()
1602-
1603-
# Offer is accepted - URL is set to None
1604-
self.assertIsNotNone(offer)
1605-
self.assertIsNone(offer.url)
1600+
self.assertEqual(resp.status_code, 400, resp.content)
16061601

16071602
# Missing URL
16081603
del self.data["url"]

adserver/views.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,11 +1122,12 @@ def ignore_tracking_reason(self, request, advertisement, offer):
11221122
log.log(self.log_level, "Ad impression for unknown publisher")
11231123
reason = "Unknown publisher"
11241124
elif not advertisement.flight.show_to_geo(geo_data):
1125-
# This is very rare but it is visible in ad reports
1125+
# Check again that the geo-targeting matches
11261126
# I believe the most common cause for this is somebody uses a VPN and is served an ad
11271127
# Then they turn off their VPN and click on the ad
1128+
# These should not be billed to advertisers and can be safely ignored.
11281129
log.log(
1129-
self.log_security_level,
1130+
self.log_level,
11301131
"Invalid geo targeting for ad [%s]. Country: [%s], Region: [%s], Metro: [%s]",
11311132
advertisement,
11321133
geo_data.country,

docker-compose/django/start

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,8 @@ set -o nounset
1010
# Don't auto-migrate locally because this can cause weird issues when testing migrations
1111
# python manage.py migrate
1212
python manage.py runserver 0.0.0.0:5000
13+
14+
# In production, we use gunicorn
15+
# This gets us close to that setting for development and testing
16+
# https://docs.gunicorn.org/en/stable/settings.html
17+
#gunicorn config.wsgi --bind 0.0.0.0:5000 --reload --log-file - --access-logfile -

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ethical-ad-server",
3-
"version": "5.29.0",
3+
"version": "5.29.1",
44
"description": "",
55
"main": "index.js",
66
"engines": {

requirements/production.in

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
-r base.in
22

33
# Gunicorn is the WSGI server used to run Django
4-
gunicorn
4+
# For an app where the vast majority of requests are I/O bound API requests
5+
# gevent may be a good choice for increased concurrency
6+
# https://docs.gunicorn.org/en/stable/design.html#choosing-a-worker-type
7+
# https://docs.gunicorn.org/en/stable/settings.html#worker-class
8+
gunicorn[gevent]
59

610
# Database driver
711
# https://www.psycopg.org/psycopg3/docs/basic/install.html

requirements/production.txt

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,11 @@ frozenlist==1.8.0
120120
# aiosignal
121121
geoip2==5.1.0
122122
# via -r base.in
123-
gunicorn==23.0.0
123+
gevent==25.9.1
124+
# via gunicorn
125+
greenlet==3.2.4
126+
# via gevent
127+
gunicorn[gevent]==23.0.0
124128
# via -r production.in
125129
hiredis==3.3.0
126130
# via redis
@@ -156,9 +160,9 @@ propcache==0.4.1
156160
# via
157161
# aiohttp
158162
# yarl
159-
psycopg[binary,pool]==3.2.10
163+
psycopg[binary,pool]==3.2.11
160164
# via -r production.in
161-
psycopg-binary==3.2.10
165+
psycopg-binary==3.2.11
162166
# via psycopg
163167
psycopg-pool==3.2.6
164168
# via psycopg
@@ -185,7 +189,7 @@ requests==2.32.5
185189
# django-slack
186190
# geoip2
187191
# stripe
188-
sentry-sdk==2.42.0
192+
sentry-sdk==2.42.1
189193
# via -r production.in
190194
six==1.17.0
191195
# via python-dateutil
@@ -234,3 +238,10 @@ whitenoise==6.11.0
234238
# via -r base.in
235239
yarl==1.22.0
236240
# via aiohttp
241+
zope-event==6.0
242+
# via gevent
243+
zope-interface==8.0.1
244+
# via gevent
245+
246+
# The following packages are considered to be unsafe in a requirements file:
247+
# setuptools

0 commit comments

Comments
 (0)