         callback null
     else
 
-        # look for same, take the first one
+        # Look for same, take the first one.
         fromCozy = null
         for cozyContact in cozyContacts
             if CompareContacts.isSamePerson cozyContact, fromGoogle
                 fromCozy = cozyContact
                 break
 
+        # When the contact has been created or updated.
         endCb = (err, updatedContact) ->
-            log.debug "updated #{name} err=#{err}"
-            return callback err if err
-            numberProcessed += 1
-            realtimer.sendContacts
-                number: numberProcessed
-                total: total
-            callback null, updatedContact
+            if err?
+                log.error "An error occured while creating or updating the " + \
+                          "contact."
+                log.raw err
+                return callback err
+
+            log.debug "updated #{name}"
+
+            # Retrieve contact's picture.
+            addContactPicture updatedContact, gContact, (err) ->
+                log.debug "picture err #{err}" if err
+
+                # Throttle the async loop to prevent performance burst.
+                setTimeout ->
+
+                    # Send progress data to the client.
+                    numberProcessed += 1
+                    realtimer.sendContacts
+                        number: numberProcessed
+                        total: total
+
+                    # Process the next item.
+                    callback null
+                , 10
 
         if fromCozy? #  merge
             log.debug "merging #{name}"

        log.debug "got #{contacts?.google?.length} contacts"
        return callback err if err
        total = contacts.google?.length
        updatedContacts = {}
        async.eachSeries contacts.google, (gContact, cb) ->
            addContactToCozy gContact, contacts.cozy, (err, updatedContact)->
                updatedContacts[gContact.id.$t] = updatedContact
                cb err
        , (err)->
            return callback err if err
            async.eachSeries contacts.google, (gContact, cb) ->
                updated = updatedContacts[gContact.id.$t]
                if updated?
                    addContactPicture updated, gContact, (err) ->
                        log.debug "picture err #{err}" if err
                        setTimeout cb, 10
                else
                    cb()
            , (err) ->
                return callback err if err

                _ = localizationManager.t
                notification.createOrUpdatePersistent "leave-google-contacts",
                    app: 'import-from-google'
                    text: _ 'notif_import_contact', total: total
                    resource:
                        app: 'contacts'
                        url: 'contacts/'
                callback()

    req.on 'error', callback
    req.end()


# get a list of every contact of a google account
module.exports = (token, callback) ->
    access_token = token
