On migration if lat/lng already provided I want to skip geocoding.

For now I can set static value in MigrateEvents::PRE_ROW_SAVE and remove that in MigrateEvents::POST_ROW_SAVE to mark that entity saving in migration.
In geocoder_field_entity_presave need to use that static value to skip geocoding if value exists.

We need the same capability for workspace publishing, because that process is only re-saving the latest workspace-specific revision as the default one, so field data is not changed.

Issue fork geocoder-3301512

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

kiseleva.t created an issue. See original summary.

kiseleva.t’s picture

Status: Needs work » Needs review
StatusFileSize
new833 bytes
amateescu’s picture

Version: 8.x-3.x-dev » 8.x-4.x-dev

The modern replacement for drupal_static() use-cases is a request attribute :)

amateescu’s picture

Title: Posibility to skip geocoding on migration if value is not empty » Extend the ability to skip geocoding when processing a large number of entity updates, like migrations or workspace publishing
Issue summary: View changes

Pushed a commit that uses the new request attribute during workspace publishing.

amateescu’s picture

Issue tags: +Workspaces support
s_leu’s picture

The MR looks good to me. One consideration here: As the presave hook is so expensive, it may be worth triggering a hook/an event that allows other modules to react when the hook is fired to skip further execution?

alecsmrekar’s picture

Looks good to me as well!

plach’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me as well :)

itamair made their first commit to this issue’s fork.

itamair’s picture

Status: Reviewed & tested by the community » Postponed (maintainer needs more info)

Thanks for all this, but I had some difficulties to understand what exactly is going on here.
I particular how the attached #2 patch and the MR !60 are going to solve kind of same goals in a general way and in two different contexts of Migrate and Workspace modules.

It looks most of the folks here do belong to TAG1 and perfectly know what you are debating about and accomplishing within the Workspace module logics, isn't it?
Though it would also help some better description of what is going to be implemented here.
I mostly did and understood it myself ... digging in the the MR !60.
BUT it would be hard for a normal contributor to understand all the logics and its dependencies, also because the Workspace module is still missing basic documentation and help content.

So I feel to forward the following requests:

  1. could you proper provide some better extended description of what (additional functional logics) is supposed to be achieved here, at once on both Migrate and Workspace sides? ...
  2. and mostly could you properly let me know if both the #2 patch and the MR !60 should be deployed in parallel (as RTBC) or even better could / should the #2 patch be grouped / embedded in the MR !60 itself?

Thanks!

  • itamair committed 69986883 on 8.x-4.x authored by amateescu
    Issue #3301512 by amateescu, itamair, kiseleva.t, s_leu, alecsmrekar,...
itamair’s picture

Status: Postponed (maintainer needs more info) » Fixed

Ok I better inspected all this and all makes great sense to me also.
I just added a commit on better commenting.
Going to deploy this into new incoming 8.x-4.26 Geocoder release.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

rosk0’s picture

This needs to be re-open and implemented better - it doesn't account for non-browser context and breaks normal flow when a content entity is saved from the scheduled cron job or in a Drush call.

This is what I'm getting in logs:

   WARNING  Attempt to read property "attributes" on null in modules/contrib/geocoder/modules/geocoder_field/geocoder_field.module on line 179.
   Error  Call to a member function get() on null.

There is no request in set in this context.

Update: correction to the above statement - I was testing a piece of code with drush php which indeed doesn't have a request set, but drush php:script has it set.

amateescu’s picture