Пример #1
0
def fxa_email_changed(data):
    ts = data["ts"]
    fxa_id = data["uid"]
    email = data["email"]
    cache_key = "fxa_email_changed:%s" % fxa_id
    prev_ts = float(cache.get(cache_key, 0))
    if prev_ts and prev_ts > ts:
        # message older than our last update for this UID
        return

    # Update SFDC
    user_data = get_user_data(fxa_id=fxa_id, extra_fields=["id"])
    if user_data:
        sfdc.update(user_data, {"fxa_primary_email": email})
    else:
        # FxA record not found, try email
        user_data = get_user_data(email=email, extra_fields=["id"])
        if user_data:
            sfdc.update(user_data, {"fxa_id": fxa_id, "fxa_primary_email": email})
        else:
            # No matching record for Email or FxA ID. Create one.
            sfdc.add({"email": email, "fxa_id": fxa_id, "fxa_primary_email": email})
            statsd.incr("news.tasks.fxa_email_changed.user_not_found")

    sfmc.upsert_row("FXA_EmailUpdated", {"FXA_ID": fxa_id, "NewEmailAddress": email})

    cache.set(cache_key, ts, 7200)  # 2 hr
Пример #2
0
def apply_updates(database, record):
    """Send the record data to ET to update the database named
    target_et.

    :param str database: Target database, e.g. 'Firefox_Account_ID'
    :param dict record: Data to send
    """
    sfmc.upsert_row(database, record)
Пример #3
0
def apply_updates(database, record):
    """Send the record data to ET to update the database named
    target_et.

    :param str database: Target database, e.g. 'Firefox_Account_ID'
    :param dict record: Data to send
    """
    sfmc.upsert_row(database, record)
Пример #4
0
def fxa_email_changed(data):
    ts = data['ts']
    fxa_id = data['uid']
    email = data['email']
    cache_key = 'fxa_email_changed:%s' % fxa_id
    prev_ts = float(cache.get(cache_key, 0))
    if prev_ts and prev_ts > ts:
        # message older than our last update for this UID
        return

    sfmc.upsert_row('FXA_EmailUpdated', {
        'FXA_ID': fxa_id,
        'NewEmailAddress': email,
    })
    cache.set(cache_key, ts, 7200)  # 2 hr
Пример #5
0
def fxa_email_changed(data):
    ts = data['ts']
    fxa_id = data['uid']
    email = data['email']
    cache_key = 'fxa_email_changed:%s' % fxa_id
    prev_ts = float(cache.get(cache_key, 0))
    if prev_ts and prev_ts > ts:
        # message older than our last update for this UID
        return

    sfmc.upsert_row('FXA_EmailUpdated', {
        'FXA_ID': fxa_id,
        'NewEmailAddress': email,
    })
    cache.set(cache_key, ts, 7200)  # 2 hr
Пример #6
0
def fxa_delete(data):
    sfmc.upsert_row('FXA_Deleted', {'FXA_ID': data['uid']})
    user_data = get_user_data(fxa_id=data['uid'], extra_fields=['id'])
    if user_data:
        sfdc.update(user_data, {'fxa_deleted': True})
Пример #7
0
def fxa_delete(data):
    sfmc.upsert_row('FXA_Deleted', {'FXA_ID': data['uid']})
Пример #8
0
def fxa_delete(data):
    sfmc.upsert_row('FXA_Deleted', {'FXA_ID': data['uid']})
Пример #9
0
def fxa_delete(data):
    sfmc.upsert_row("FXA_Deleted", {"FXA_ID": data["uid"]})
    user_data = get_user_data(fxa_id=data["uid"], extra_fields=["id"])
    if user_data:
        sfdc.update(user_data, {"fxa_deleted": True})