Menu

#51 on_script variable variables, different sender vs. subscribe

SarraBeta
closed-fixed
nobody
None
5
2018-06-02
2016-09-22
psilva
No

In sender scripts to mess with the file name to be written, one must modify
parent.msg.remote_file

in subscribe and/or sarra scripts one must modify:
parent.msg.local_file.

It would be better if there were a single variable used for both cases 'destination_file' ?

When one wants to change the directory in which a local file is placed, one needs to modify two separate fields

parent.msg.local_dir, and parent.msg.local_file.

If you only modify local_dir, the directory gets created, but the file gets written somewhere else.
if you only modify local_file, then the create fails because the expected directory does not exist.

working plugin attached.

would prefer it local_dir would just use local_file, so we didn't need a second directory...

even better would be to derive it from 'destination_file'.

1 Attachments

Discussion

  • psilva

    psilva - 2016-09-26
    • Priority: 5 --> 7
     
  • psilva

    psilva - 2016-11-06
    • summary: on_script variable variables... --> on_script variable variables, different sender vs. subscribe
     
  • psilva

    psilva - 2017-02-03
    • Group: deferred --> v2.16.00b
     
  • psilva

    psilva - 2017-06-06

    suggested solution:
    before calling any on_message / on_part / on_file scripts have:

    New standard:
    the file to be written is called new_
    so new_files, and new_lock
    -- in sr_sender these replace: remote_file, remote_lock.
    -- in sr_consumers, these replace: local_lock, local_file.

    so for compatibility, if local_file or remote_file is changed in a plugin,
    after the plugins run, you need to update new_file.
    same for local_lock / remote_lock.

    same for remote_dir|local_dir needs to update --> new_dir.

    on_save_context
    -- routine, stores variables in self.xxx -> self.b4.xxx
    -- call the on whatever routines.
    -- compare the self.xxx and self.b4.xxx
    -- if self.xxx != self.b4.xxx :
    update self.new_xxx from self.xxx

    All the rest of the code needs to be modified to use new_* everywhere.

     
  • psilva

    psilva - 2017-06-06
    • Priority: 7 --> 5
     
  • psilva

    psilva - 2017-06-06

    This is why DESTFNSCRIPT/DESTFN is broken in all consumers right now (refers to remote_file, when it needs to be local_file.)

    that's why the priority has been raised.

     
  • psilva

    psilva - 2017-06-14

    This is fixed in 2.17.06a2 -- all scripts now use new_file (rather than some subscribers using local_ and sender using remote_ )

     
  • psilva

    psilva - 2018-06-02
    • status: open --> closed-fixed
     
  • psilva

    psilva - 2018-06-02

    Resolved by refactoring between 2.17.07 and 2.18.01

     

Log in to post a comment.

MongoDB Logo MongoDB