Skip to content

Commit

Permalink
Fixes gpkc/nameko-microservices/gpkc#3 - uses hmset and hgetall to st…
Browse files Browse the repository at this point in the history
…ore and retrieve a dictionary with redis
  • Loading branch information
mervynsimzr committed Oct 26, 2019
1 parent ae2848a commit f1f9f3b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ services:
- redis-data:/data

rabbit:
image: rabbitmq:3.6-management
image: rabbitmq:3-management
ports:
- "15672:15672"

Expand Down Expand Up @@ -53,4 +53,5 @@ services:
RABBIT_PORT: "5672"

volumes:
redis-data:
redis-data:

4 changes: 2 additions & 2 deletions trips/trips.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ class TripsService:

@rpc
def get(self, trip_id):
trip = self.redis.get(trip_id)
trip = self.redis.hgetall(trip_id)
return trip

@rpc
def create(self, airport_from_id, airport_to_id):
trip_id = uuid.uuid4().hex
self.redis.set(trip_id, {
self.redis.hmset(trip_id, {
"from": airport_from_id,
"to": airport_to_id
})
Expand Down

0 comments on commit f1f9f3b

Please sign in to comment.