Ejemplo n.º 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
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 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})
Ejemplo n.º 7
0
def fxa_delete(data):
    sfmc.upsert_row('FXA_Deleted', {'FXA_ID': data['uid']})
Ejemplo n.º 8
0
def fxa_delete(data):
    sfmc.upsert_row('FXA_Deleted', {'FXA_ID': data['uid']})
Ejemplo n.º 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})