2020-02-03 23:37:18 +00:00
|
|
|
import logging
|
|
|
|
from google.cloud import pubsub_v1
|
|
|
|
|
|
|
|
publisher = pubsub_v1.PublisherClient()
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
|
|
|
|
def update_tag(username, tag_id):
|
2020-05-08 15:19:27 +01:00
|
|
|
"""Queue serverless tag update for user"""
|
2020-02-03 23:37:18 +00:00
|
|
|
logger.info(f'queuing {tag_id} update for {username}')
|
2020-05-08 15:19:27 +01:00
|
|
|
|
|
|
|
if username is None:
|
|
|
|
logger.error(f'no username provided')
|
|
|
|
return
|
|
|
|
|
|
|
|
if tag_id is None:
|
|
|
|
logger.error(f'no tag_id provided for {username}')
|
|
|
|
return
|
|
|
|
|
2020-02-03 23:37:18 +00:00
|
|
|
publisher.publish('projects/sarsooxyz/topics/update_tag', b'', tag_id=tag_id, username=username)
|